The Notification Center was introduced in OS X 10.8 (Mountain Lion). Off the shelf OS X and macOS don’t have the means to send alerts from the Terminal to Notification Center (at least, not that I know of). There is, however, a handy script that will do make this possible. In this Mac Tip I will explain how to go about it.
How to send Notification Center alerts from Terminal
- You need to install a simple script onto your system. It’s perfectly safe to do so, and there are a number of approaches you could take. I believe the easiest it to use Homebrew. If you don’t know what Homebrew is, please view that page, and install it. It’s very simple to install.
- With Homebrew installed, install the formula called
terminal-notifier. So the command you’ll use is,
brew install terminal-notifier
- Set up the notifications you want:
Here is an example of a notification:
terminal-notifier -message “Go to Best-Mac-Tips.com, to get the latest Mac tips\!” -title “best-mac-tips.com” -open https://best-mac-tips.com
Try it out, and see what happens.
NOTE: The first time you run this, you may need to allow notifications. You’ll see a request popup, like this:
What to do with it?
Exactly what you use Terminal Notifier for is entirely over to you. There must be something you had in mind when you came looking for this how-to tip.
Here’s an example of a simple message:
terminal-notifier -message "This is a demo message from Best Mac Tips" -title "Best Mac Tips Message Title"