Davide Targa website

Programming, web development and open source

Install Rvm on Ubuntu

RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems. Let’s see how to install it!

In order to install RVM you need a few packages:

1
$ sudo apt-get install build-essential curl zlib1g-dev libreadline5-dev libssl-dev libxml2-dev

Install RVM with the following command:

1
$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

RVM will be downloaded and compiled automatically. To complete the installation now run:

1
$ /var/lib/gems/1.8/bin/rvm-install

As the last step you have to add the following line to the file .bashrc in your home. So edit it with your favourite editor or create it if it doesn’t exist.

1
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

To verify the installation, type rvm -v and the output should be the following:

1
2
$ rvm -v
rvm 1.0.15 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]

Now to install ruby inside rvm use the simple command:

1
$ rvm install 1.9.2

1.9.2 is the version of the ruby interpreter that you want to install. RVM automatically downloads the sources from the internet, compiles and install them. To set 1.9.2 as the default version use the command:

1
$ rvm --default 1.9.2

Enjoy with ruby!

Comments