Push Notifications from the Command Line Using Pushover

How to use Pushover to get notified when commands finish.

Posted on January 3, 2014 by Mike Buss

Push Notifications from the Command Line Using Pushover

Sometimes I want to leave my computer and be notified when a script finishes. After playing around with a few solutions, I found one that works well!

One quick note: This solution is for people who don't have an Apple Developer account. If you have an account and want to build your own solution, I would suggest checking out Nomad CLI Tools - specifically the tool called Houston.

Step 1: Download Pushover

Pushover is a free service that lets you send push notifications from their REST API and receive them with their iOS app.

You can download the Pushover iOS app for $5 from this link.

Pushover App

Step 2: Sign Up On Pushover's Website

Before continuing, you'll need a user key and API key from the official Pushover website.

  • Sign up for an account using this link.
  • Make note of the user key found in the top right after logging in.
  • Create an app using this link. You can name the app whatever you'd like - I called mine "iTerm".
  • Make note of the API key shown after creating an app.

Step 3: Add ZSH/Bash Function

Pushover's REST API lets you send messages using a simple cURL command. Add this function to your .zshrc (if you're using ZSH) or .bashrc (if you're using Bash) file, usually located at ~/.zshrc or ~/.bashrc.

function push {
    curl -s -F "token=YOUR_TOKEN_HERE" \
    -F "user=YOUR_USER_KEY_HERE" \
    -F "title=YOUR_TITLE_HERE" \
    -F "message=$1" https://api.pushover.net/1/messages.json

Be sure to replace the token and user fields with the values you received from the Pushover website. You should also add a value for the title key.

Step 4: Test It Out

Run the following command to make sure everything is configured properly:

$ sleep 3; push "It worked\!"

Pushover App

If all goes well, you should see the push notification appear on your phone. To use this in the future, just replace sleep 3 with your long-running command.

Pushover App

If it didn't go through, you should check the FAQ on the official Pushover website or send me a line.


Pushover makes it simple to send push notifications to your iOS device. I use it for long-running scripts, but I'm interested to see how other people adapt the same idea! Let me know how you use Pushover at @michaeltbuss.