Quick Tip: system-wide notifications with notifyutil

Image of an old-fashioned-looking telephoneI just discovered this, thus don’t know a lot about it, but notifyutil is a pretty cool command line utility in OS X. I know it exists in both Lion and Mountain Lion, not sure how long it’s been around before that.

What it does is tap into the system-wide notifyd daemon, allowing you to post and receive notifications between multiple applications/scripts. From the man page:

notifyutil is a command-line utility for interacting with the notifyd(8) notification server. It may be used to post notifications, detect and report notifications, and to examine and set the state value associated with a notification key.

For a quick idea what it can do, pop open a terminal and run this:

notifyutil -1 neato && osascript -e 'say "wow, thats pretty cool"'

Then, open another window or tab (or even a different Terminal app) and run:

notifyutil -p neato

Wow, that is pretty cool.

The -1 in the first command tells it to wait for a single notification. You can set that to any integer, or use -w to wait indefinitely. I have some grand scripting ideas for this, but they’ll have to wait a bit. Nose to the grindstone, shoulder to the wheel and all of that.

Brett Terpstra

Brett is a writer and developer living in Minnesota, USA. You can follow him as ttscoff on Twitter, GitHub, and Mastodon. Keep up with this blog by subscribing in your favorite news reader.

This content is supported by readers like you.