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.
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
.
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:
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.
If it didn't go through, you should check the FAQ on the official Pushover website or send me a line.
Conclusion
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.