For the last few years I’ve been using Growl and Growl Notifier on the command-line to get asnc notifications when long running builds and tests have finished. Now that OSX Mountain Lion has it’s built-in Notification Center, the next inevitable question is how to get this same functionality in Notification Center.
The answer is a utility called terminal-notifier which can be downloaded from github. Just unzip the binary and drag it to your Applications folder and you’ll have access to the terminal-notifier command in terminal.
Here’s an example of how I use this for running tests in the background. When the tests finish you’ll get a notification which you can click on if you want the results.
mvn test; terminal-notifier -message "Your tests are done. \ $(num_failures) failures." \ -open http://localhost:8080/my/test/results/index.hml