Upgrading to Ruby 2.0

If you are using the rvm for managing Ruby versions and are in Ruby 1.9.X version and want to upgrade to Ruby 2, this blog will help.  So hoping that you have installed rvm on your system this is how you upgrade to Ruby 2.0

First in your bash / terminal you need to tell rvm to check for latest stable release of Ruby. For that type this command (of course without the $)


$ rvm get stable

This will update rvm  with latest stable releases. Now you can get the list of known by typing this command


$ rvm list known

This will list some stuff like this


# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p371]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3-p125
[ruby-]1.9.3-p194
[ruby-]1.9.3-p286
[ruby-]1.9.3-p327
[ruby-]1.9.3-p362
[ruby-]1.9.3-p374
[ruby-]1.9.3-p385
[ruby-]1.9.3-[p392]
[ruby-]1.9.3-head
[ruby-]2.0.0-rc1
[ruby-]2.0.0-rc2
[ruby-]2.0.0[-p0]
ruby-head

Notice that you have [ruby-]2.0.0[-p0] which is nothing but but Ruby 2.0,to install it type this


$ rvm install 2.0.0

Once installed to use Ruby 2.0 just type this


$ rvm use 2.0.0

Now how to switch to other versions of Ruby, well just type


$ rvm list

This will list the versions of ruby available in your system, the following is the out put in my system


rvm rubies

=* ruby-1.9.3-p362 [ x86_64 ]
ruby-2.0.0-p0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

This shows I have Ruby 2.0 and Ruby 1.9.3-p362. To switch to  Ruby 1.9.3-p362 (in my case) type


$ rvm use 1.9.3-p362

and you would have switched to that version of Ruby!!!

Advertisements

, , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: