Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 368
Alex Morega Avatar asked Aug 02 '12 12:08

Alex Morega


2 Answers

Check out terminal-notifier on GitHub.

like image 104
Rolleric Avatar answered Oct 05 '22 15:10

Rolleric


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"
like image 42
gregers Avatar answered Oct 05 '22 15:10

gregers