[Mac] terminal-notifier is convenient for notifying when Terminal commands complete!

Tadashi Shigeoka ·  Thu, April 20, 2017

I’ll introduce terminal-notifier, which is convenient for notifying when commands complete in Terminal on Mac.

Installing terminal-notifier

terminal-notifier can be installed via Homebrew.

brew install terminal-notifier

How to use terminal-notifier

{command} && terminal-notifier -message '{message}' -sound default

(Example) Notify ‘Done! Terminal task’ after sleep command completes and play default sound

sleep 1s && terminal-notifier -message 'Done! Terminal task' -sound default

Set up alias to make it easier

Since writing terminal-notifier -message ‘{message}’ every time is tedious, setting up an alias is recommended.

~/.bashrc or ~/.zshrc

alias notifier='terminal-notifier -message "Done! Terminal task"' -sound default

After setting up the alias, you can receive notifications with {command} && notifier, making it a bit easier.

That’s all from the Gemba.