Skip to main content
Luis de la Rosa

Ruby bugs on Leopard

I installed Leopard about 2 weeks ago and been doing Ruby on Rails development on it since. I encountered some bugs initially, but I managed to conquer them. I think Leopard's great for doing RoR development. It seems faster, it seems more polished, its just very pleasant to do work in.

Here's what I learned though about Ruby in Leopard:

  1. Don't update rubygems. It's already up-to-date (at least as of this writing.) If you do a "gem update --system" on Leopard, you will be sorry. Because you'll suddenly break the careful packaging Apple has done with Ruby and reduce the 20 or so gems (not sure the exact count) available down to 0.

There's a simple fix for this though - what happens is that the places where it looks for your gems gets mixed up. What you need to do is go into your ~/.bash_profile and enter in:

export GEM_HOME=/Library/Ruby/Gems/1.8
export GEM_PATH=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

Then do a

source ~/.bash_profile

The reason why this fixes it is that GEM_PATH now points to the place where Apple put all the system-provided gems. GEM_HOME points to where Apple originally set to where you install gems. Note that GEM_PATH is "read-only" whereas GEM_HOME Is "read-write" by rubygems. Oh and if you do this, you can safely update rubygems. :)

  1. rcov is broken, but you can fix it.

For some reason, rcov out of the box will include some of its own classes in the reports when profiling functional tests on Leopard. This throws off the coverage statistics.

The fix for this is to include "#{ENV['GEM_HOME']}" in the rcov exclusions parameter --exclude.

  1. rcov reports don't show up colorized in Safari 3.

Now once you've got rcov working, when you click on a class to see what lines are covered and which aren't, you find out that you can't on Leopard. Well that's not exactly right. It turns out that its Safari 3. I also tested it out with the latest WebKit nightlies - its broken too. I looked into this and found that some old rcov 0.4 reports on the web render fine, but the newer rcov 0.8 ones don't. It seems Safari 3 doesn't like some of the internal anchor tags.

The workaround for this is to use any other browser for viewing your rcov reports on Leopard. If you're using Firebug, you might as well use Firefox. Otherwise, Camino is good. Or if you're the power user type, OmniWeb. Cutting edge - Shiira. I could go on and on - I'm a browser fanatic. Did I mention Flock?

Anyways... Ruby development on Leopard is actually quite good. These 3 bugs were not that big a deal. I think its great that Leopard ships with all sorts of Ruby goodness built right in. And I didn't even mention RubyCocoa or anything like that.

Any other tips for Ruby development on Leopard? Let me know via a comment!