Saturday, June 9, 2007

Upgrading to Ruby 1.8.6 on OS X

So I've been playing around with Ruby and decided I also wanted to learn the Rails framework while I continue my Ruby learning. I mean Rails is pretty much the big driving force of me learning Ruby so I might as well learn both at the same time. So anyhow I do my Ruby development in OS X which comes with Ruby 1.8.2 by default (OS X 10.4). I wanted to upgrade to the latest stable (1.8.6) but didn't want to spend a lot of time playing around in the shell. I could do it in the shell I suppose, but I'm not that big of a geek anymore :). So here's what I did to get everything up and going..

Step one - I downloaded MacPorts  and installed it (easy enough)

Step two - after MacPorts was installed I opened up a shell and typed in 'sudo port upgrade ruby'

Step three - I downloaded RubyGems and un-compressed it

Step four - another shell and 'sudo ruby setup.rb' from the un-compressed gems folder

Step five - another shell and 'sudo gem install rails --include-dependencies


well.. not so fast.. I did run into a little show-stopper when I tried installing Rails from RubyGems. I kept getting an exception when trying to retrieve any gems. After a little Googling around I found that there were quite a few people that have experienced the gems not working. The problem ended up being the gem cache. When trying to pull a gem from the server it wouln't find it and throw an exception. So to fix it I pulled up a shell and typed in 'gem env', which prints the environment settings of RubyGems, then grabbed the path info ('/opt/local/lib/ruby/gems/1.8'). Once I got into the gem path directory I deleted 'source_cache'. I guess this fixed many peoples issues, I ended up having to re-install RubyGems to get it working. Oh well all is good now though.

1 comment:

BlackTigerX said...

I'll have to wait 'til I get Leopard, hopefully by October