
Ruby 1.9.2 was just released last week (and the RubyInstaller for Windows was updated a couple days later.)
Similarly, IronRuby recently released version 1.1 last month.
If, like me, you currently have an older version of Ruby installed like 1.8.7, how can you upgrade while ensuring there are no compatibility issues with code you’ve written or 3rd party gems/plugins you’ve used?
You could spin up a new VM instance, sure, but that seems like a lot of overheard for testing a new language.
A pile of RubiesEnter RVM, the Ruby Version Manager. (If you don’t happen to use a linux distro or OSX, there’s a similar project called Pik available for Windows.)
Intro to RVM1.0 was just released; rejoice! From the RVM homepage:
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.
Installation is a breeze using the RVM shell script:
$ curl http://rvm.beginrescueend.com/releases/rvm-install-head | sh
This uses curl to download the script source and pipes it to the shell to be run. There is one additional step, and that’s to edit your shell configuration (~/.bash_profile on my OSX machine):
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
Then just open a new shell session and start using RVM. Some helpful commands are:
$ rvm install 1.8.7 $ rvm install 1.9.2 $ rvm list $ rvm --default 1.9.2 $ rvm 1.8.7
(The RVM documentation has more information on commands and their usage.)
Pik for WindowsPik is similar to RVM, but works on Windows. It’s “just a gem”, so installation is also a breeze. First, create a c:\pik\ directory and add it to your PATH environment variable. Then just:
c:\> gem install pik && pik_install c:\pik\
I already had 1.8.7, 1.9.2 and IronRuby installed, so to make pik aware of them I only had to run:
c:\> pik add c:\Ruby187\bin c:\> pik add c:\Ruby192\bin c:\> pik add c:\ironruby-1.1\bin c:\> pik list c:\> pik switch 1.9.2
(Refer to the Pik documentation for more commands.)
Cross-platform, side-by-side language installations. So good.




