Switching from RVM to chruby
If you do much Ruby development you undoubtedly use a Ruby version manager. In the last few years, the Ruby community has successively adopted RVM, then rbenv, and now chruby.
I’m a stick-in-the-mud, so I’ve just stuck with RVM for the past few years. It’s not an ideal tool, but it wasn’t really broken; why fix it? I’ve kept an eye on chruby, though. A lot of folks I respect have been singing its praises, and I appreciate the simplicity of it. No monkeying with shell commands! No gemsets! So pretty! But it wasn’t quite enough to overcome my RVM inertia.
However, I’ve spent the past few weeks teaching a Rails bootcamp at Metis, and we want to teach our students the current best practices. This includes using chruby, so I figured it was time to accept the inevitable and finally switch over.
It’s actually really easy! Just heave a sigh, cross your fingers, and blow away your RVM installation:
$ rvm implode $ rm -rf ~/.rvmrc ~/.rvm
You’re almost certainly calling an RVM script in your shell config (
.zshrc, or whatever you use). Delete that reference; you
won’t need it anymore.
ruby-install. I’m assuming you’re on a Mac, but if
you’re on some other Unix there are instructions in the chruby README.
$ brew install chruby ruby-install
If you try to run
chruby now, your shell will complain that the command wasn’t
found. This can be fixed by adding the following line to your shell’s config
Next you’ll want to install a current Ruby. At the time of this writing, that’s 2.1.2:
$ ruby-install ruby 2.1.2
Finally, you’ll probably want to use that as your default Ruby, so add a
2.1.2 to the end of your shell config.
Boom! You’re now all set with chruby. You can install new Rubies with
ruby-install and switch between them with
chruby. Pretty clean.
But there’s one more thing! I (vocally) use Emacs, and it’s nice to have the
correct version of Ruby available in my editor. This just requires installing
chruby package (available in MELPA) and adding
(chruby "2.1.2") to your
That’ll do it! I’m finally switched over, and I’m liking chruby a lot so far. A worthwhile migration!
You might like these textually similar articles: