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.
- Install RVM
- Install and activate Ruby 1.8.7 via
rvm install 1.8.7; rvm 1.8.7
- Get jrom’s patched version of RubyOSA that supports modern OS X
- Install the gem from source:
And now you should have a working installation of RubyOSA. Script away!