The smart thing to do: outsource the job of installing / upgrading / getting the lastest version to RVM. Here’s the website:
https://rvm.io/rvm/install/
To install RVM, in the command line, run:
curl -L https://get.rvm.io | bash -s stable --ruby
If you just happened to install xcode (required for rvm), you may run into the following error message:
Error installing new MacPorts base: command execution failed
If that happens, you just need to finish installing xcode:
sudo xcode-select --install
There is also another error you could get in new machines:
command not found: port
To solve this, in your /etc/paths directory, enter the following at the end:
/opt/local/bin
/opt/local/sbin
Once RVM is in place, getting the latest version of Ruby on your machine is also a breeze:
rvm get head && rvm reload
Since RVM allows you to choose which version of Ruby you want to run, it also lets you pick a gem set, which you can customize to work for that version. To do that run:
rvm use 1.9.3@devgemset --create --default
This will instruct rvm to create a get set called devgemset, and set it as the default gem set for 1.9.3
RVM also installs RubyGems as part of its magic, so now you have an in-house gems manager under the hood. To verify RubyGems is there, run:
which gem
To install rails in your system, run:
gem install rails -v 3.2.3