OSX Terminal Notifications

I recently found myself task-switching quite a bit, and losing track of longer running programs in the process. I went looking for a low effort way to get Terminal to display a notification when a program exited while terminal (or the running shell session) was in the background. I quickly found a solution in two parts:


terminal-notifier is a Mac App that provides a simple CLI to create notifications in notification center. Pipe text in, get a notification out. Easy.

Now for the shell integration:


zsh-notify is a plugin for zsh that supports terminal-notifier, as well as growl (for ye olden MacOS versions ;)).


There’s really only one option to configure, and that’s the notification timeout. You set this as an environment variable:


This will create a notification for any task that takes longer than 5 seconds. The default is 30, which is way too long for my twitchy, app-switching fingers.

Cool, but I don’t use zsh…

Well, you should give it a try!

I don’t use bash any longer, but with terminal-notifier it’s super easy to fire them off ad hoc:

./run-a-long-program && terminal-notifier -message "Finished run-a-long-program"

And voila!

terminal-notifier screenshot

But seriously, you should try zsh.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s