Confused Development

I develop software and I often get confused in the process. I usually find the answers after a while, but a month later I can't remember them. So from now on, I will write them down here.

Sunday, March 09, 2008

Problems with Conflicting Ruby Versions

I havn't posted much lately, but of course I'm still very confused. Just now, I was pulling my hair out when I tried to follow the simple rails tutorial on the Apple developer site. I got to the point where I was supposed to build the scaffolding for the data model like so:

$ script/generate scaffold event name:string budget:decimal

Unfortunately, this is when I got a nasty complaint:

Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org

This seemed very weird, especially because I had just installed gems 1.0.1 - I could even prove it:

$ gem -v
1.0.1

Things like that frustrate me, especially when it's late at night. Luckily, after some digging, I found out that the problem was that I had installed Ruby in various different places, which seemed to upset things. In had used MacPorts to install it in /opt/local/bin, but another ruby lived in /usr/bin, which is where Apple installs it by default (both version 1.8.6). Deinstalling the MacPorts version solved the problem then:

$ which ruby
/opt/local/bin/ruby
$ sudo port uninstall ruby
Password:
--->  Deactivating ruby 1.8.6-p110_0+darwin_9+thread_hooks
--->  Uninstalling ruby 1.8.6-p110_0+darwin_9+thread_hooks
$ which ruby
/usr/bin/ruby

Now I'm less confused.