Getting started with chruby

13 December 2012

If you're looking for crazy simplicity in your 'switch between multiple Rubies' life, you may want to check out chruby. Written by Postmodern, it's basically the simplest possible thing that can work. As in, 76 lines of shell script.

For that, you get:



Kinda crazy, eh?


Most of the time, I install things from homebrew, but I actually prefered to run the script:

tar -xzvf chruby-0.2.3.tar.gz
cd chruby-0.2.3/

You can see the source for that script here. You'll end up with an MRI, JRuby, and Rubinius all installed in /opt/rubies, and after restarting your shell, you should be good to go!


To see what Rubies you've got, just chruby:

$ chruby

to pick one:

$ chruby 1.9.3

Pretty damn simple.

Getting more Rubies?

The setup script will install ruby-build, so just use that to get more rubies:

ruby-build 1.9.3-p327 /opt/rubies/ruby-1.9.3-p327

You'll then need to update your list of Rubies in your .bashrc or .zshrc:

  # other rubies here

If you find this tedius, you can just glob them:


Automatic switching?

Not yet. This is pretty much the only thing keeping me from saying 'zomg use this for sure now.'

How good is it?

I don't know, I've been using it for less than 24 hours. Seems good.