Installing Rubinius with Rbenv

by Andrew Stewart
published September 6, 2013

EDIT: (2013-09-27) - Updated to reflect that RBENV_VERSION is now ‘rbx’ (at least for me). Check the value yourself if it isn’t working.

(Disclaimer: These steps may not work for you. This is just what got my system working. If you have any feedback or step suggestions, let me know.)

While gearing up for a new release of the gitnesse gem, I noticed the RSpec suite was failing in JRuby and Rubinius on Travis. To fix this, I had to install both Rubies on my system.

Let’s start by installing them through ruby-build. Easy enough, right?

$ rbenv install jruby-1.7.4
Downloading jruby-1.7.4.tar.gz...
Installing jruby-1.7.4...
Installed jruby-1.7.4 to /Users/stewart/.rbenv/versions/jruby-1.7.4

Ok, That went well. Now let’s install Rubinius!

$ rbenv install rbx-2.0.0-dev
Downloading yaml-0.1.4.tar.gz...
Installing yaml-0.1.4...
Installed yaml-0.1.4 to /Users/stewart/.rbenv/versions/rbx-2.0.0-dev

Installing rubinius-2.0.0-dev...


Inspect or clean up the working tree at /var/folders/6n/pd5r9l_x73s6vv656xzy1rph0000gn/T/ruby-build.20130906193908.56657
Results logged to /var/folders/6n/pd5r9l_x73s6vv656xzy1rph0000gn/T/ruby-build.20130906193908.56657.log

Last 10 log lines:
  --without-fibers           Disable fibers
  --with-dtrace              Enable dtrace
  --without-dtrace           Disable dtrace

  --show                     Print the current configuration and exit
  -V, --verbose              Print additional info
  -h, --help                 Show this message

Unrecognized option: --with-readline-dir=/usr/local/opt/readline

Ah. That’s not quite what I was expecting. We can still built it manually, though, since rbenv doesn’t really care how the Ruby gets installed:

$ git clone && cd rubinius
$ ./configure --prefix=~/.rbenv/versions/rbx-2.0.0-dev
$ rake install

After this is done, we can switch over to using Rubinius:

$ rbenv shell rbx-2.0.0-dev

Alright. Now let’s try installing Bundler, so we can install RSpec and run the tests:

$ cd ~/dev/project

$ gem install bundler && rbenv rehash
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed

$ rbenv which bundle
rbenv: bundle: command not found

The `bundle' command exists in these Ruby versions:

It turns out that Rubinius uses a different install path for gem binaries than most other Rubies, so rbenv can’t find them by default. Luckily, there’s a plugin that fixes that. Let’s install it:

$ mkdir -p ~/.rbenv/plugins
$ cd ~/.rbenv/plugins
$ git clone

This plugin helps, but it’s not compatible with the most recent (as of this writing) version of Rubinius. We can fix that by changing the relevant files:

make_shims ../versions/rbx-2*/gems/bin/*
if [ ! -x "$RBENV_COMMAND_PATH" ] && [[ $RBENV_VERSION =~ rbx ]]; then

And now we’re off to the races:

$ cd ~/dev/project
$ rbenv which bundle

While I was writing this, Brian tweeted at me, letting me know that I should use Chruby instead of Rbenv. Currently rbenv is too integrated into my workflow and shell to switch over to chruby on a whim, but I’ll have to give it a shot at some point and see if it makes it easier to get up and running with multiple Rubies.

UPDATE: It does.