Starting in Ruby with RVM

Written by Arvinder Singh / June 29, 2012 / 2 mins read / Filed under Ruby, / Rvm

This piece is a contribution to Intermediate Ruby Programming - a free ruby course for newcomers run by

One of the problems that many new-bees in a language face while following while following a book or tutorial is the problem on dealing with different versions of the language e.g. version 1.8.7 and version 1.9.2 in the case of Ruby. If you are running Linux or OS X, do not worry - we got rvm power!

What is RVM?

Ruby enVironment (Version) Manager (RVM) is a command-line tool developed by Wayne E. Seguin which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems. You can install and separately manage more than one Ruby interpreter including MRI, JRuby and the kind.


Most Linux/OS X using bash will have the necessary tools, including git - required to install RVM. However you can check the location of installed tools typing this on your bash prompt.

for name in {bash,awk,sed,grep,ls,cp,tar,curl,gunzip,bunzip2,git,svn} ; do which $name ;  done

If any of the tool is missing, you may install the missing package using apt-get in Linux or using Homebrew on OS X.

Installing RVM

The simplest way to install rvm is using rvm-installer script by typing the following on your bash prompt:

bash < <(curl -s

If you don’t trust the installer script, you can follow the instructions given here and download and inspect the script before installing.

Loading RVM into your shell

To make sure you can use rvm as a function or command from your bash shell, add the following at the end of your .bash_profile file located in your home folder.

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile

Reload shell configuration and test

The simplest way to reload a shell is to close and restart it. If you are lazy like me and don’t want to do that, try reloading your .bash_profile

source .bash_profile

Now lets test if all went well

type rvm | head -1

If all went well, you should see this response

rvm is a function

Install a ruby interpreter

To see a list of Ruby interpreters available to us, run this command

rvm list known

You should see a list of Ruby interpreters available to be installed. For the purpose of this class, we’ll install Ruby 1.9.2

rvm install 1.9.2

Once the installation completes, lets give this new ruby a spin

rvm use 1.9.2
ruby -v

You should see something like following depending on your OS and installed version.

ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]

To load this version as our default version of Ruby, run the following command

rvm use 1.9.2 --default

Thats all! Enjoy creating fun in Ruby.