[Mac] terminal-notifier is convenient for notifying when Terminal commands complete!
I’ll introduce terminal-notifier, which is convenient for notifying when commands complete in Terminal on Mac.
terminal-notifier can be installed via Homebrew.
brew install 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
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.