How can I install Ruby on Rails 3 on OSX?

macos, ruby, ruby-on-rails, ruby-on-rails-3

Solution

First you need to install RVM, then the latest version of Ruby. Next you'll set that version of Ruby as the default. Finally, you'll install Rails b3.

Install RVM (http://rvm.beginrescueend.com/rvm/install/):

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Install the latest Ruby (http://rvm.beginrescueend.com/rubies/installing/):

rvm install ruby-head

You can check which versions you now have installed with:

rvm list

Set the latest version of Ruby as default (replace 'ruby-1.9.2-head' with desired version):

rvm ruby-1.9.2-head --default

Make sure things are up to day, then install the Rails beta:

gem update --system
gem install rails --pre

You may have to install some gem dependencies before Rails will install.

Problem

I got a White Macbook and I have to go to a conference in 10 hours but I'm having a lot of problems. First, I wanted to have Rails 3, so I used MacPorts to install Ruby 1.8.7. It worked well ;) Then I was thinking I should install Rails 3, but no, no! It says: ``` $ sudo gem install rails --pre ERROR: Error installing rails: activesupport requires Ruby version >= 1.8.7. ``` What should I do? I already have 1.8.7!

Original source