How to install RVM on Ubuntu 10.04

by Irish on August 25, 2010

I’ve heard people describe frustrations they had in getting Rails 3 setup on Ubuntu 10.04 with Ruby 1.9.2. I’m going to outline the steps I’ve taken to do this. Let’s get started installing RVM.

It should be noted that I created a fresh slice on my Rackspace Cloud account to create this tutorial. And I’m assuming you’ve already setup SSH.

$ ssh root@173.XXX.XXX.XXX
<-- Output Snipped -->
root@173.XXX.XXX.XXX's password:
<-- Output Snipped -->

Alright, so lets confirm we don’t have ruby installed

$ which ruby

Cool, nada. Let’s grab the basic dependencies

$ sudo apt-get install curl git-core ruby
Reading package lists... Done
Building dependency tree
<-- Output Snipped -->

Now we’ll install RVM as per their instructions

$ bash -s stable < <(curl -s )

<-- Output Snipped -->

RVM: shell scripts which allow management of multiple ruby interpreters and environments.
HELP: (#rvm on

* Installing rvm to /usr/local/rvm/
Correct permissions for base binaries in /usr/local/bin...
Copying manpages into place.

Notes for Linux ( DISTRIB_ID=Ubuntu

<-- Output Snipped -->

* For JRuby (if you wish to use it) you will need:
$ aptitude install curl sun-java6-bin sun-java6-jre sun-java6-jdk
* For MRI & ree (if you wish to use it) you will need (depending on what you are installing):
$ aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf
* For IronRuby (if you wish to use it) you will need:
$ aptitude install curl mono-2.0-devel

<-- Output Snipped -->

WARNING: you have a 'return' statement in your .bashrc, likely this will cause untold havoc.
This means that if you see '[ -z "$PS1" ] && return' then you must change this line to:
if [[ -n "$PS1" ]] ; then
... original content that was below the && return line ...
fi # <= be sure to close the if.
#EOF .bashrc
Even if you use zsh you should still adjust the .bashrc as above.
If you have any questions about this please visit #rvm on

Installation of RVM to /usr/local/rvm/ is complete.

The last part in there about the .bashrc file is important! Using your editor of choice, open the .bashrc file that resides in your user directory.

You need to replace the line that says

[ -z "$PS1" ] && return


if [[ -n "$PS1" ]]; then

Now add this to the last line of the file

if [[ -s $HOME/.rvm/scripts/rvm ]] ; then source $HOME/.rvm/scripts/rvm ; fi


And yes there needs to be that last fi as it closes the one we added earlier. Save this file with our changes. Now we can check if RVM is setup correctly.

$ rvm notes

If this doesn’t work you may have to source your .bashrc file to have it reloaded by the current terminal session

$ source ~/.bashrc

After running `rvm notes` if it gives you installation notes about RVM then you’re good to continue, otherwise double check you edited your .bashrc file correctly.

In the notes output RVM tells you what packages you’re gonna need to install for various flavors of Ruby. Since we’re going with 1.9.2 we want the packages it lists under the MRI & ree section. Let’s install those now.

$ sudo aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf

<-- A really long bit of Output Snipped -->

Now we can look at all the RVM known Ruby packages

$ rvm list known
# MRI Rubies

# JRuby

<-- Output Snipped -->

Next we install the version we want and set it as the default. You’re gonna see RVM install ruby-1.8.7-p302 first, be patient as it will need to also install rubygems-1.3.7, before it finally gets to that 1.9.2.

$ rvm install 1.9.2-head
<-- Output Snipped -->
info: Installing ruby-1.8.7-p302
<-- Output Snipped -->
info: Installing rubygems dedicated to ruby-1.8.7-p302...
<-- Output Snipped -->
info: Installing ruby-1.9.2-head
<-- Output Snipped -->
info: Updating rubygems for /usr/local/rvm/gems/ruby-1.9.2-head
$ rvm --default 1.9.2-head
$ ruby -v
$ ruby 1.9.2p0 (2010-08-18 revision 29034) [x86_64-linux]

Good to go.

{ 71 comments… read them below or add one }

luca August 29, 2010 at 12:39 pm

I found it very useful.
Thank & keep on the good job.

bye luca


Rafael August 29, 2010 at 9:19 pm

Nice post, really useful, please continue with the install of rails 3 final.

Now that it is released the need for good tutorials is even more :)


Carl Zulauf August 30, 2010 at 9:54 pm

I really like the clarity of your instructions. I hope you get the article on settings up Rails 3 posted soon. In the meantime I’ll snapshot my VM and wander in the dark trying random methods of installation. Thanks :-)


Alwin August 31, 2010 at 5:40 am

Hey Chris,

Thanks for consolidating at one place all thats needed to install ruby on Linux. I followed your instructions and successfully installed rvm and ruby on my machine (ubuntu 10.04). I also installed rails by executing the following command that I found out from elsewhere on the net:

gem install rails –pre

after the installation I created a directory rubydev in my home folder (/home/alwin) and then successfully created a dummy web application in it using the command:

~/rubydev$ rails new hello

when I try to execute the command “ruby script/generate controller App” from the folder “~/rubydev/hello”, it gave the error “ruby: No such file or directory — script/generate (LoadError)”

Please help me fix this problem.

Some of the commands which can be relevant in this situation and their respective outputs for my machine are as under:

~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29034) [i686-linux]

~$ which ruby

~$ echo $PATH

Thanks in advance


Jesse August 31, 2010 at 9:43 pm

Thanks, exactly what I was looking for.


yasha September 5, 2010 at 9:45 am

Thanks a lot , I was having some troubles with the .bashrc , but I got it here


Karl September 8, 2010 at 8:21 am

Thanks a lot, this was really helpful for me!


Seth September 10, 2010 at 5:47 pm

Good stuff, exactly what I needed! Thanks for taking the time to document the process.


Tobias September 12, 2010 at 9:02 am

This helps a lot!

maybe you could add, that after editiinf the .bashrc you have to do the rvm check in a new terminal window.


Willem September 28, 2010 at 12:57 am

Thanks! This was very helpful.


Sam September 30, 2010 at 9:22 am

Doesn’t quite work for me.

Everything goes great until I run “rvm install 1.9.2-head”. I see no output from the command. Instead, bash shells are created (many per second) until the machine runs out of resources and stops updating the screen. Here is a sample of the “ps aux” output:

sweber 6483 0.0 0.5 5344 2548 pts/0 S+ 17:55 0:00 bash /home/sweber/.rvm/scripts/manage install 1.9.2-head
sweber 6526 0.0 0.3 5344 1848 pts/0 S+ 17:55 0:00 bash /home/sweber/.rvm/scripts/manage install 1.9.2-head
sweber 6534 0.0 0.5 5344 2548 pts/0 S+ 17:55 0:00 bash /home/sweber/.rvm/scripts/manage install 1.8.7
sweber 6577 0.0 0.3 5344 1848 pts/0 S+ 17:55 0:00 bash /home/sweber/.rvm/scripts/manage install 1.8.7

I’ve tried several variations on the .bashrc edit. Other sources seem to suggest that the sourcing lines should be outside the instructions bracketed by the “if”. Same results.


Shaun October 21, 2010 at 10:17 am

Great post, very thorough! It’s exactly what I was looking for too, only exception being that I’m using Ubuntu 10.10, but all the instructions worked perfectly. Thanks!


Jasper Kennis November 16, 2010 at 3:22 am

It’s strange, I’ve followed al the steps, but “$ruby -v” returns “ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]“. That’s not the same is it?


Irish November 16, 2010 at 11:26 pm

What happens when you do

rvm list


Kyle December 17, 2010 at 4:26 pm

I ran into this same problem. ‘rvm list’ shows the 1.8.7 ruby I installed, but if I ‘rvm use 1.8.7′ then ‘ruby -v’ I still get the linux system ruby. ‘which ruby’ always returns /usr/bin/ruby.


Kyle December 17, 2010 at 6:10 pm

Wayne pointed me to the solution on #rvm. Needed to replace $HOME/.rvm/ with /usr/local/rvm/ as I was root

Thanks for this blogpost.


Rob November 23, 2010 at 1:56 pm

This was _exactly_ what I needed! Good work, and thanks!


PandaWood December 4, 2010 at 10:27 pm

I’m afraid it doesn’t work for me:
echo executable host ruby is required. use –with-baseruby option.; false -I. ./tool/compile_prelude.rb ./prelude.rb miniprelude.c
executable host ruby is required. use –with-baseruby option.


PandaWood December 4, 2010 at 11:14 pm

Further to previous comment where it didn’t work using:
rvm install 1.9.2-head

It does work if I use the command without -head ie:
rvm install 1.9.2


Irish December 6, 2010 at 9:34 am

Hmm… perhaps 1.9.2 head isn’t at a stable version now??


Sean February 2, 2011 at 1:55 pm

Needs to be: rvm install 1.9.2–head
Note the double dashes.


Ragmaanir November 8, 2011 at 8:00 am

When i do: rvm install 1.9.2–head
i get the same error. So, I installed without -head now.


Sean February 2, 2011 at 1:58 pm

$ rvm –default 1.9.2–head – Doesn’t actually set –default for me.

This does though:
$ rvm 1.9.2–head –default

Thanks for the tutorial. Really helped. Wish RVM came as a default package in Ubuntu.


Brandon February 3, 2011 at 1:39 am

This is one where you have to sort of take a serious look at the documentation, sometimes I get complacent with aptitude…

The docs instruct that you simply change the ‘return’ line to:
[code]if [[ -n "$PS1" ]]; then
# Some code here... e.g.
export HISTCONTROL=ignoreboth

and then add [code][[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
A restart of bash yielded great success…


Alex February 5, 2011 at 6:09 pm

Great stuff! I’ve referenced it twice so far and it’s worked perfectly.


Jamie February 16, 2011 at 4:23 am

Thank you very much for this, I tried once before but gave up. This went without a hitch.


jukey February 20, 2011 at 10:21 am

Thank you very much for this installation guide. Without this guide I would never have put the correct content into the .bashrc. Did you already told the rvm developer about that?


Sreenivas Kapila February 24, 2011 at 11:23 pm

Thank you for the simple and elegant tutorial.


Bemga February 27, 2011 at 9:07 pm

Thank you for this guide.


Keith March 3, 2011 at 3:14 pm


I was having all sorts of issues until I read this.


André Teixeira March 25, 2011 at 12:25 pm

Great, very helpfull!!!
Thanks a lot


Kresimir Bojcic March 30, 2011 at 12:34 pm

Thanks man!


Jesse House April 2, 2011 at 11:12 am

your instructions worked perfectly!
ubuntu 10.10, ruby 1.9.2, rails 3.0.5


Max Williams April 8, 2011 at 6:28 am

Very useful, thanks! One minor point – in my .bashrc file the `[ -z "$PS1" ] && return` line wasn’t at the end, it was in the middle somewhere. So rather than replacing it, i deleted it and then pasted the other three lines at the bottom.


Raine Virta April 20, 2011 at 7:05 am

The rvm curl snippet should use https now, the old one no longer works.

bash < <( curl )


Irish April 20, 2011 at 10:02 am

Ah, thanks, post updated.


Puneet Pandey April 29, 2011 at 2:39 am

Nice article. Works for me at first go. Thanks a ton for sharing. Was struggling, to setup RVM on Ubuntu.

- Puneet


bent April 29, 2011 at 9:56 pm

Thank you sir.


Ethan May 14, 2011 at 7:05 am

This is massively useful, thank you.


Niels May 16, 2011 at 12:00 pm

Strictly speaking, you should not need ruby in the dependencies, should you?
Other than that, nice tutorial.


Swetha May 17, 2011 at 9:24 am

I found your article very useful. I’m trying to install RVM on ubuntu 11.0.4 using virtual box on Windows 7. Even after accomodating all changes you suggested I’M STILL GETTING RVM: NOT FOUND.
Can you please suggest me the sloution, I’m new to Ubuntu.


Stiwi Gabriel Courage May 21, 2011 at 4:57 pm

Really simple, thanks very much.. :o )


Kalvin May 25, 2011 at 6:19 am

Thanks a lot!
Ubuntu 10.10, ruby 1.9.2 worked perfectly!


chandra sekar June 9, 2011 at 10:00 pm

Thank you for this guide…………………………..


Rafael Belliard July 12, 2011 at 10:20 pm

Awesome. Worked on 11.04 x32.


William Lee July 25, 2011 at 3:41 pm

Thanks!! worked on 11.04 x32 for me too. Saved me alot of time :D


amandeep August 1, 2011 at 9:52 am

Thanks dear just installed and configured rvm on Ubuntu 11. This is wonderful guide.


Mauro Morlaes August 18, 2011 at 9:12 am

Worked like a charm, thanks!


Simone September 3, 2011 at 7:08 am

Hi! Thanks for this guide, very useful! Only one suggest: I’m using Linux Mint 11 and .bashrc file doesn’t exist, I created manually. An hint for this case can be a good idea for other peoples like me.


Baskin October 11, 2011 at 10:28 pm


Great step-by-step post and really relevant. Helped me save the issue with my ubuntu rvm install. you’da man!


Vinothini October 24, 2011 at 12:51 am

This Post was very very useful to me.

Thanks alot

Vinothini, spritle


Nasko October 25, 2011 at 6:29 am

Really useful post, thanks a lot!


Volodymyr November 29, 2011 at 3:50 am

Maybe it helps someone. I have issue with rvm installation: rvm command wasn’t work. But I did like it says in tutorial above.
My fail was that I did like in this tutorial + edited bash_profile from another. So check this file and clean it. For me it works!


Joshua Bowles January 3, 2012 at 4:32 pm

There is now an updated install script, the one above no longer works:

bash -s stable < <(curl -s )


Irish January 3, 2012 at 5:24 pm

Thanks for the tip, I’ll update the post tonight :)


Bernard Banta January 6, 2012 at 2:16 pm

This post once helped me. Thanks Irish.


Krishna January 9, 2012 at 7:14 pm

nice page,
please update the url to install rvm. it is not working.
i tried with ubuntu 10.04
correct one is
bash < <(curl -s


Val Litvak January 22, 2012 at 10:51 pm

This is the only tutorial that really helped me get rails working on my computer and my friend’s computer, Thanks so much.


Amal George February 6, 2012 at 10:28 pm

Works great. Thanks


Leave a Comment

{ 7 trackbacks }

Previous post:

Next post: