Ruby Version Manager: Easily Use Multiple Ruby Versions At Once
Ruby Version Manager GitHub repo (a.k.a. RVM) makes it ridiculously easy to install and switch between multiple Ruby versions on OS X and Linux. Over the last 24 hours, I've been playing with RVM and talking to creator Wayne E. Seguin and have been blown away with how cool (and simple) it is - you will definitely want to check this one out.
RVM's most compelling feature is that it caters for six different distributions out of the box (MRI 1.8.6, MRI 1.8.7, 1.9.1, 1.9.2, Ruby Enterprise Edition 1.8.6, JRuby 1.3.1) and it'll install them the first time you need to use them. RVM doesn't mess up your current Ruby install - the RVM installed implementations are only activated manually by you and you can switch back to the "default" with one line.
It's possible to install different patch levels if you like too and Wayne has put together a list of examples to show you the various things RVM can do from the command line (including gem management).
Using Ruby Version Manager
I find shell sessions demonstrate how things work better than narrated instructions, so.. enjoy:
# gem install rvm # rvm-install [Follow the prompts.. you can let it edit your ~/.profile or you can do it manually]
Using a different Ruby
# rvm use 1.9.2 <i> Installing Ruby from source to: /Users/peter/.rvm/ruby-1.9.2-preview1 <i> Extracting ruby-1.9.2-preview1... <i> Configuring ruby-1.9.2-preview1 using '--enable-shared', this may take a while depending on your cpu(s)... <i> Compiling ruby-1.9.2-preview1, this may take a while, depending on your cpu(s)... <i> Installing ruby-1.9.2-preview1 <i> Installing rubygems dedicated to ruby-1.9.2-preview1... <i> Installation of ruby-1.9.2-preview1 complete. <i> Installing rake # ruby -v ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-darwin9.8.0] # gem list *** LOCAL GEMS *** hoe (1.11.0) libxml-ruby (1.1.2) minitest (1.4.2) rake (0.8.4) rdoc (2.2.2) rubyforge (1.0.3)
Note that instead of 1.9.2, you could use “ree”, “1.9.1”, “jruby” and more..
Returning to your default Ruby
# rvm use default <i> Switching to default ... # ruby -v ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
RVM is still in its early days so don't try this on your production boxes just yet - unless you're brave! (Note: Two months have passed since RVM's initial release and it is now considered production ready.) You can catch up with the creator, Wayne Seguin, on irc.freenode.net in #rvm if you'd like to discuss the project further or, perhaps contribution installation scripts of your own to be added to the project.
A massive thanks to Jamie Van Dyke for giving me the lead on this useful tool.