Alex Morega
Alex Morega

Reputation: 4228

Command-line utility to send notifications to Notification Center in Mountain Lion

Is there any command-line utility that sends notifications to Notification Center? Something similar to Growl's growlnotify.

Upvotes: 10

Views: 5544

Answers (2)

Rolleric
Rolleric

Reputation: 167

Check out terminal-notifier on GitHub.

Upvotes: 11

gregers
gregers

Reputation: 13040

In Maverics it's possible to trigger a notification from an Apple Script, but not sure if it works in Mountain Lion:

display notification "Hello!"

I made a simple command-line script to pass parameters to an apple script. One-line install:

echo -e '#!/bin/bash\n/usr/bin/osascript -e "display notification \"$*\""'|sudo -s "cd /usr/local/bin;tee notify&&chmod +x notify"

Will output code below to /usr/local/bin (must exist) and add executable flag. Make sure /usr/local/bin is in your $PATH.

#! /bin/bash
/usr/bin/osascript -e "display notification \"$*\""

Now to display a notification:

notify "Lorem ipsum dolor sit amet"
sleep 5 ; notify "Slow command finished"

Upvotes: 3

Related Questions