Rahul Rahul - 10 months ago 65
Ruby Question

How do I install the latest version of ruby in Ubuntu?

I currently have ruby version 1.8.2 in my machine and I would like to upgrade it to 1.9.2. How am i supposed to do it?


I use Ubuntu, and I've found the easiest way to install newer versions of Ruby is to use rvm.

The instructions are here: https://rvm.io/rvm/install/

Basically, it installs different versions of Ruby locally for the user and updates environment variables for Ruby and gems based on which version you decide to use.

It's this easy:

jim@schubert:~$ rvm use system
Now using system ruby.
jim@schubert:~$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
jim@schubert:~$ gem -v
jim@schubert:~$ rvm use 1.9.2
Using /home/jim/.rvm/gems/ruby-1.9.2-p180
jim@schubert:~$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-linux]
jim@schubert:~$ gem -v