Send iOS push notifications from the command line with

Dimitri James Tsiflitzis
7 min readMar 7, 2019

Sending iOS push notifications from the command line with a single bash script located on GitHub here using no external dependencies or services.

Photo by Osman Rana on Unsplash

I’ve been using push notifications in most of the apps I build for a while now. On iOS, they are the centerpiece of the remote notifications feature. They are fast, secure and decrease the required effort developers need to make in order to efficiently propagate information towards their apps and users.

Moreover, these days you can display rich and comprehensive content within them. I have written an article about that here that you might enjoy reading while finding it useful for your own app development.

So while I’m happy with the technology, there is one area where I’ve consistently found myself wanting and that’s testing them; by that, I mean being able to send them to a particular device that has an app of mine installed on it consistently and repetitively over many many times so I can test, tweak and rewrite its text and payload.

Testing push notifications on iOS

Usually, you might have your own server setup or maybe you use one of the many push notification services that already exist. All this takes a lot of time and effort to get up and running. Ideally, you would probably like to start sending notifications just with a mac, an iOS device and zero in cash (excluding the money you’ve paid for your mac and device of course).

If you’ve done some research online you’ve probably come across NWPusher which works great but only works with certificate-based authentication for certificates and keys that it reads directly from the keychain. It’s also distributed as a Mac app you need to install so it only works on that platform. You will also have to generate these certificates yourself every year and this is a multistep process each time.

The shell script solution

Instead of certificate-based notifications, I used token-based instead, which are much easier to set up and manage. Also, instead of creating a graphical app to send notifications with, I wrote a bash shell script to do so. It is called and is located on GitHub here and is fully documented there…

Dimitri James Tsiflitzis

Developer, scrum enthusiast, @sequeapp building productivity apps; formerly @nimber, @peopleperhour, @taxibeat; game dev @sprimp and orgniser @cocoaheadsgr