Sunday, May 19, 2024
spot_img

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

spot_img

Related Stories

2 Comments

  1. This doesn’t work at all.
    The most it would do was give the “allow” notification after install, but then no matter how many messages I have typed into terminal, not a single one has popped up.
    Maybe it’s too old to work on Monterey.
    It is enabled in system preferences.
    It just doesn’t work at all.

    • Thanks for the feedback of your experience. I’ve just now tested it in macOS 14.3.1. It’s still working fine for me. So long as I don’t have “Do not disturb” mode on, it will show up as per normal. screenshot

Average
5 Based On 1

Leave A Reply

Please enter your comment!
Please enter your name here

Stay on op - Ge the daily news in your inbox