Send an alert to Notification Center from the command line

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

  1. 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.
  2. With Homebrew installed, install the formula called terminal-notifier. So the command you’ll use is, brew install terminal-notifier
  3. 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:

Click Allow.

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"

 

Recent Articles

Related Stories

Leave A Reply

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Stay on top - Get updates in your inbox