Last Updated: February 25, 2016
· phillipoertel

Use rvm aliases in .rvmrc files

A typical .rvmrc looks like this:

> cat .rvmrc
rvm use ruby-1.9.2-p290@projectname

This is brittle, at least for me. Since I don't want to keep dozens of Ruby versions and their gemsets around, I uninstall an older patch level version after installing the latest one. But then you need to update .rvmrc files where the old patch level is referenced. 'rvm alias' to the rescue:

> rvm alias create ruby-1.9.2 ruby-1.9.2-p290

# now use the alias in the .rvmrc
> vi .rvmrc
rvm use ruby-1.9.2@projectname

Done. This configures what I actually care about, which is an up to date Ruby 1.8, 1.9 or 1.9.2 version, or JRuby.