RVM on Ubuntu 10.04

I'm beginning the coding phase on a new project. A few days ago rails 3.0.0 was released. I'm going to hop on that bandwagon. And I've decided i'm going to install ruby 1.9.2.

During the obligatory google'ing I discovered RVM: Ruby Version Manager, and I particularly liked this blog post in which contains the phrase "...let’s move the fuck on people, the first preview of 1.8 was released in 2002, and 1.9 has been here for three years!"

I couldn't agree more with his thoughts on 1.9, especially since it's supposed to be MUCH faster. I remember watching a video of Matz last year speaking in his horribly broken engrish about 1.9. I recall him saying how 1.9 fixed many/all of the fundamental logic flaws in 1.8x. Logic flaws? That sounds like something I want to get away from anyway.

So here I go, Documenting what I did to get RVM up and running on my main development box(Ubuntu 10.04).

you'll need some of this:
sudo apt-get install build-essential

and this:
sudo apt-get install curl

sudo apt-get install zlib1g-dev libreadline5-dev libssl-dev libxml2-dev

NOTE: RVM is ruby code itself, so you'll need ruby and rubygems already installed(if you're reading this I'm sure this is already the case)

then i ran:
sudo gem rvm install

and this is what it spit out:


In order to setup rvm for your user's environment you must now run rvm-install.
rvm-install will be found in your current gems bin directory corresponding to where the gem was installed.

rvm-install will install the scripts to your user account and append itself to your profiles in order to
inject the proper rvm functions into your shell so that you can manage multiple rubies.

Successfully installed rvm-1.0.2
1 gem installed
Installing ri documentation for rvm-1.0.2...
Installing RDoc documentation for rvm-1.0.2...

OK looks good so far, i ran
like it told me to and got this huge output:

RVM: shell scripts which allow management of multiple ruby interpreters and environments.
RTFM: http://rvm.beginrescueend.com/
HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net)

* Installing rvm to /home/eric/.rvm/
Correct permissions for base binaries in /home/eric/.rvm/bin...
Copying manpages into place.ls: cannot access ./man: No such file or directory

Notes for Linux ( DISTRIB_ID=Ubuntu

* NOTE: MRI stands for Matz's Ruby Interpreter (1.8.X, 1.9.X), ree stands for Ruby Enterprise Edition and rbx stands for Rubinius.

* curl is required.

* patch is required (for ree, some ruby head's).

* If you wish to install rbx and/or any MRI head (eg. 1.9.2-head) then you must install and use rvm 1.8.7 first.

* 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

Eric Young,

Thank you for using rvm. I hope that it makes your work easier and more enjoyable.
If you have any questions, issues and/or ideas for improvement please hop in #rvm on irc.freenode.net and let me know.
My irc nickname is 'wayneeseguin' and I hang out from ~09:00-17:00EST and again from ~21:00EST-~00:00EST.
If I do not respond right away, please hang around after asking your question, I will respond as soon as I am back.
Be sure to get head often as rvm development happens fast, you can do this by running 'rvm update --head'.
~ Wayne

You must now finish the install manually:
1) Place the folowing line at the end of your shell's loading files(.bashrc or .bash_profile for bash and .zshrc for zsh), after all path/variable settings:
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
Please note that this must only occur once - so, you only need to add it the first time you install rvm.
2) Ensure that there is no 'return' from inside the .bashrc file. (otherwise rvm will be prevented from working properly).
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 Be absolutely *sure* to REMOVE the '&& return'. If you wish to DRY up your config you can 'source ~/.bashrc' at the bottom of your .bash_profile. placing all non-interactive items in the .bashrc, including the 'source' line above 3) Then CLOSE THIS SHELL and open a new one in order to use rvm. 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 irc.freenode.net. Installation of RVM to /home/eric/.rvm/ is complete.

Ok, so it's warning me about the return statement, I must admit I don't know exactly what this means, so I'll follow the instructions verbatim.

I actually added the:
[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm
to the bottom of my ~/.profile file (which is linked from ~/.bashrc)

then I refreshed my bash profile settings with this command:
source ~/.profile

And now when i run
I get what looks like the usage manual, ok, looking good so far(I think), Now I wanna get me some 1.9.2

rvm install 1.9.2
spit out:
info: Installing Ruby from source to: /home/eric/.rvm/rubies/ruby-1.9.2-p0

info: Downloading ruby-1.9.2-p0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 8296k 100 8296k 0 0 74580 0 0:01:53 0:01:53 --:--:-- 67103

info: Extracting ruby-1.9.2-p0 ...

info: Configuring ruby-1.9.2-p0, this may take a while depending on your cpu(s)...

info: Compiling ruby-1.9.2-p0, this may take a while depending on your cpu(s)...

info: Installing ruby-1.9.2-p0

info: Installation of ruby-1.9.2-p0 is complete.

info: Updating rubygems for /home/eric/.rvm/gems/ruby-1.9.2-p0@global

info: Updating rubygems for /home/eric/.rvm/gems/ruby-1.9.2-p0

info: adjusting shebangs for ruby-1.9.2-p0 (gem irb erb ri rdoc testrb rake).

info: Importing initial gems...

Awesome, I feel the end is near.

Woo, it's done and it worked:

eric@elydevbox:~$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
eric@elydevbox:~$ rvm 1.9.2
eric@elydevbox:~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]
eric@elydevbox:~$ irb
ruby-1.9.2-p0 > puts "hi"
=> nil
ruby-1.9.2-p0 >


an excerpt from http://marcgrabanski.com/articles/gem-management-with-rvm-and-bundler
Dont forget about gems:

Gem Management with RVM

RVM has “gemsets” which allow you to organize different sets of gems. If you install gems into the global gemset, then it will be available to you no matter which gemset you are using.

Create the global gemset.
rvm gemset create global
rvm gemset use global

Install gems here that will be used in projects like bundler and passenger.

gem install bundler
gem install passenger

Notice that I never use sudo because rvm puts these gemsets in your user ~/.rvm directory.

Now create and use your project gemset.

rvm gemset create YOUR_GEMSET
rvm gemset use YOUR_GEMSET

Obviously YOUR_GEMSET can be anything you want. Then you are set to go!