Growl notifications from Ruby on OS X

July 6, 2010

I wanted to generate Growl notifications from a Ruby script on OSX and had a bit of trouble getting it to work. To save you the same hassle, here's the steps I took:

Install growl

Install Growl if you haven't already. I used version 1.2.

Set some growl preferences

In the growl preference plane (find it under System Preferences)

  • under network check "Listen for incoming notifications" and "Allow remote application registration"
  • restart growl

Install the ruby-growl gem

There's a couple of different ruby bindings for Growl but ruby-growl seemed to work for me

gem install ruby-growl

Send a growl notification from your Ruby script

You can now send notifications from Ruby

require 'rubygems'
require 'ruby-growl'

g = Growl.new "127.0.0.1", "ruby-growl", ["ruby-growl Notification"]

g.notify "ruby-growl Notification", "It Came From Ruby-Growl", "Greetings!"
Published