virtualMachineruby

List the installed Ruby versions

To list the currently installed Ruby versions, execute:

$ rvm list
rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.

As the message states, if no Ruby version is installed, the list will be empty. After installing, the output will change to the below:

$ rvm list

rvm rubies
   ruby-1.9.1-p431 [ i386 ]
=* ruby-1.9.2-p320 [ i386 ]
# => - current
# =* - current && default
#  * - default

Select a Ruby from the list of installed versions

Changing the Ruby interpreter being used is as easy as executing:

$ rvm use ruby-1.9.2-p320

to use Ruby 1.9.2 (for example).

To verify the result, execute:

$ rvm list
rvm rubies
 * ruby-1.9.1-p431 [ i386 ]
=> ruby-1.9.2-p320 [ i386 ]
# => - current
# =* - current && default
#  * - default

Or simply:

$ ruby --version
ruby 1.9.2p320 (2012-04-20 revision 35421) [i386-darwin11.2.0]

It is also possible to use the system Ruby (the main Ruby installed with the Bitnami stack, not through RVM) by executing:

$ rvm use system
Now using system ruby.

Install a new Ruby version

You can get the list of all the available Ruby versions by invoking:

$ rvm list known

This will print a list like:

...
# MRI Rubies
...
[ruby-]1.8.7-head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
...
[ruby-]1.9.3-[p194]
[ruby-]1.9.3-head
ruby-head

To install a new Ruby from the list (eg. ruby-1.9.1-p431), execute:

$ rvm install ruby-1.9.1-p431

RVM will take care of downloading, unpacking and compiling the requested Ruby.

You may not find the Ruby version that you are looking for if using an outdated version of RVM. Use the following command to first update your list of available versions:

$ rvm get stable

Uninstall an existing Ruby version

You can uninstall an existing RVM-managed Ruby version by executing:

$ rvm uninstall ruby-1.9.1-p431