Installing Ruby on Rails with MacPorts on Tiger Server
May 27 2008 - By George Webster
Thanks to MacPorts installing getting Ruby on Rails up and running couldn't be simpler. Seriously its just 3 commands...or well after you have installed MacPorts and Xcode.
Once you have installed the above issue the following two commands.
sudo port install ruby rb-rubygems
Then:
sudo gem install --include-dependencies rails
Now you have a fully functional install of Ruby on Rails...except your OS X came with ruby pre-installed, and if you are running tiger you also have gems and rails pre-installed. This means that your system most likely is looking for the pre-installed version, so when you run your script/server it will give you confusing error telling you to install the lastest version of gems...strange we just installed that.
The solution is to "hide" the pre-installed version of ruby from OS X so it uses the MacPorts version:
sudo mv /usr/bin/ruby /usr/bin/ruby.orig
If you are running a later version you may have to run the following as well:
sudo mv /usr/bin/gem /usr/bin/gem.orig sudo mv /usr/bin/rails /usr/bin/rails.orig
Thats it! now you should be running your MacPorts version. Enjoy!
Many thanks to all of the forums I crawled looking for this solution.