Semi-painless multiple Ruby version management with rvm

I love the CSS preprocessor language SASS; I'm starting to think I love it even more than LESS (sorry, LESS!) However, despite the fact that Drupal is a big PHP application, most usages of SASS within its ecosystem (particularly Omega, el gordo) require you to also use Ruby with all sorts of gems. How can you ease the pain of introducing a brand new (and idiosyncratic) technology, if it's not your core competency, and isn't ever likely to be?

Enter rvm, or Ruby Version Manager (not to be confused with most other popular uses of the suffix -VM.) This manages entirely separate installations of ruby and its gems, in your home directory rather than overwriting the system files, and employs path-variable trickery to convince your terminal to use whichever one you decide on.

It's very straightforward to install, although sadly it resists package management using something like apt, preferring the somewhat frivolous "pipe a random URL into your local bash" method of installation; for example, for the stable version:

\curl -sSL | bash -s stable --ruby

This will tweak your terminal startup files—.zshrc, .bashrc, .bash_profile and others—so that rvm can hook in.

Installing a new version of ruby is now very easy:

rvm intall ruby-1.8.7-head

It will also install the relevant version of rubygems management. Switching between versions is straightforward too:

rvm use 1.8.7

And rvm list will list all installed versions. There are one or two applications which won't run under rvm (Bytemark's BigV client is one of them): for them, you can run rvm use system to fall back to your system-wide installation of ruby and take rvm out of the equation altogether.

The only issue I've found is that, after some time not using it, rvm ends up with broken download URLs for packages. In theory you can fix this with rvm get head; in practice, you might also need to install a gpg key so that the updates are trusted (even though the initial install used curl!) It's almost like they're inventing aptitude, piece by piece....

Anyway, I'm no fan at all of Ruby, and certainly not an expert; and I don't think adding massive, complex moving parts to an existing, quite complex technical stack is how you ensure it remains robust. But for use on your development environment, rvm has been an absolute godsend for me!