Monday, April 14, 2008

Getting Ruby to Run on Tiger (as if you haven't heard that before)

Today I had the [ahem] pleasure of getting ruby to run in Tiger.

I had been using Locomotive... but that appears to be terribly out-of-date (May 2007).

I had hopes that sakuzaku's script would do the trick... but it failed in several places. Afterwards, nothing worked.  Honestly, I wasn't paying very close attention to it as it ran, and didn't crack it open to see what was going on... but that was my starting point.

I think the basic problem was that I had two other installations of ruby: one in /sw/bin/ruby, and the second in /usr/bin/ruby.  ...So, after the script failed, I went and nuked those two executables and made them symlinks to /usr/local/bin/ruby.

But my gems were still miffed (I was trying to write a very, very simple script to go grab some XML from a web-app, and I was parsing it with hpricot).  That turned out to be an easy fix:
export PATH=$GEM_HOME/bin:$PATH
export RUBYOPT=rubygems
export RUBYLIB=$GEM_HOME/lib/ruby/site_ruby/1.8/
(clearly, this is in bash) ...And that did the trick.

Yes, yes, I know: I need to upgrade to Leopard.  But I'm running on a G5, and I've heard the performance hit is considerable... so I'm dragging my feet.

No comments: