Using terminal-notifier to Improve Shell Workflow

If you haven’t seen it, terminal-notifier is a wrapper around Mac OS X Notification Center written by @alloy and now maintained by @julienXX. You use it to show a message in Notification Center. I use the shell very frequently, and sometimes I run a command, leave it running and move on to do something else before coming back to check the results. terminal-notifier helps with this process since I don’t have to manually check several times. For e.g., I build my blog using blogofile, so I can do something like:

blogofile build; terminal-notifier -message ‘Blog build done’

I’ll usually want to relaunch the blog test server after building, so I do:

blogofile build; terminal-notifier -message ‘Blog build done’; blogofile serve

Once I see Blog build done appear, I can go to Safari and reload the page I’m working on.

terminal-notifier also supports running opening a URL (with -open) or running a command (with -execute) when you click on the notification, like this:

blogofile build; terminal-notifier -message “ok” -open http://localhost:8080; blogofile serve

I use terminal-notifier often enough for such notifications that I have a wrapper script called ok around it:

terminal-notifier -message “ok” -open “$1”

So I can just run:

blogofile build; ok http://localhost:8080; blogofile serve

Originally published at