Upgrade Ruby on Mac OS X

Ruby Version Manager (RVM)
RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. RVM provides the flexibility to use any version of Ruby that you require. It also can be use to upgrade your current ruby version on Mac OS X. You can look for more info at here: https://rvm.io

So now, let’s try open new Terminal, and run this command:
ruby -v

Likely, it’ll show version number ruby 1.8.7.
If you’re just starting out with Ruby, don’t use an old version; you want 1.9.2!
So here is there steps to upgrade your ruby version to the current latest version via RVM.

Step 1
Open a terminal and run the following command:
\curl -L https://get.rvm.io | bash -s stable –ruby

Step 2
After a few seconds of installation, we need to make the RVM available to the shell. We’ll do this by updating our ~/.bash_profile file.

cd ~/
sudo vim .bash_profile
[[ -s “$HOME/.rvm/scripts/rvm” ]] && source “$HOME/.rvm/scripts/rvm” # This loads RVM into a shell session.

* If this file does not exist, you should create it manually. Paste the following to the bottom of the page.

Step 3
To be safe, let’s restart the terminal to make sure that everything took effect. To ensure that RVM is correctly installed, type:
rvm

Step 4
Ensure you have the latest version of Xcode

Step 5
To download Ruby 1.9.2, open a new terminal, and type:
rvm list known

You’ll see a long list of versions…
$ rvm list known
1.8.7[-p352]
1.8.7-head
1.9.1-p378
1.9.1[-p431]
1.9.1-head
1.9.2-p180
1.9.2[-p290]
1.9.2-head
ruby-head

Now, let’s try install Ruby 1.9.2:
rvm install 1.9.2

That should take a moment to install.

Once the installation has completed, we need to tell RVM which version of Ruby we currently want to use. Run the following comamnd:
rvm use 1.9.2

Next, test it by checking the version number:
ruby -v

It should returns ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0].
Nice. Now you’re now using Ruby 1.9.2.

If you closed the terminal, and run the ruby -v command, and it returns the old version of ruby, you need to specify the latest ruby version.

Open new terminal, and run this command:
rvm –default use 1.9.2

So now it should be as we wanted. 🙂

Any Comments?