RVM Has Directory Level Configuration Support

Just learned RVM can automatically switch ruby versions based on the current directory.

No more trying to remember which magic rvm use incantation will return your project to a working state.

Terminal
1
$ rvm --ruby-version use [RUBY_VERSION]@[GEMSET_NAME]

The above will switch to the specified ruby version and gemset and drop two files in the directory:

  • .ruby-version will be a one-liner with the ruby version you want
  • .ruby-gemset will be a one-liner with the gemset you want to use

For example:

Terminal
1
2
3
4
5
6
7
$ rvm --ruby-version use ruby-1.8.7-p302@rails-3.0.3

$ cat .ruby-version
ruby-1.8.7-p302

$ cat .ruby-gemset
rails-3.0.3

Comments