Installing RubyOSA on Mac OS X Lion

I recently decided to do some scripting of a Mac app, but I wanted to avoid touching AppleScript, because… well, because it’s not fun. RubyOSA is the natural choice for someone who likes Ruby, since it lets you skip the AppleScript step and go straight to the Apple Event “metal.” However, on modern systems (e.g. Lion), RubyOSA has trouble compiling the native gem extensions necessary for installation. It also doesn’t play well with Ruby 1.9. So, here are the basic steps I used to get it working.

  1. Install RVM
  2. Install and activate Ruby 1.8.7 via rvm install 1.8.7; rvm 1.8.7
  3. Get jrom’s patched version of RubyOSA that supports modern OS X
  4. Install the gem from source:
    1. ruby extconf.rb
    2. make
    3. make install

And now you should have a working installation of RubyOSA. Script away!

This entry was posted in code. Bookmark the permalink. Both comments and trackbacks are currently closed.