Skip to content

Instantly share code, notes, and snippets.

@wolfeidau
Last active December 14, 2015 02:09
Show Gist options
  • Save wolfeidau/5011992 to your computer and use it in GitHub Desktop.
Save wolfeidau/5011992 to your computer and use it in GitHub Desktop.
How to install ruby-2.0.0-p0 into rbenv with dtrace support

The aim of this post is to guide the reader through the process of installing ruby 2.0.0 into rbenv with dtrace probes enabled. As rbenv uses ruby-build, which currently downloads and compiles a copy of openssl rather than using the one maintained and updated in homebrew i prefer to use the homebrew one.

Note that you MUST install xcode before installing anything, then install homebrew, and lastly install openssl, via homebrew as follows.

brew install openssl

Next to overcome the fact that OSX doesn't have an openssl ca certificate bundle, use the following brew to create and maintain one using the CA certs stored in your keychain.

brew tap raggi/ale && brew install openssl-osx-ca

Make a temporary directory to build the sources in, download the 2.0.0-p0 and extract it into this location, then navigate into the ruby-2.0.0-p0 directory containin the sources.

mkdir ~/temp && cd ~/temp
curl -L ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.bz2 | tar xjf -
cd ruby-2.0.0-p0

Run configure file with the arguments as listed below.

./configure --prefix=$HOME/.rbenv/versions/2.0.0-p0 --enable-dtrace \
--with-opt-dir=`brew --prefix openssl`

Within this rather verbose output you should see the following, this indicates that dtrace has been included.

checking whether dtrace USDT is available... yes

Build ruby, note I am invoking make with the ‘-j’ or ‘--jobs’ option tells make to execute many recipes simultaneously, in my case 9.

make -j9 

Now install ruby into rbenv with the label 2.0.0-p0.

make install

To try it out we will alter our shell to use the 2.0.0-p0 version.

rbenv shell 2.0.0-p0

Running ruby -v should output the following.

ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]

You can remove the temporary directory you built ruby in now.

rm -r ~/temp

NOTE: Bundler has just been updated to cater for ruby 2.0.0 but you will need to retrieve the gem manually and install it as follows.

wget https://rubygems.org/downloads/bundler-1.3.0.gem
gem install bundler-1.3.0.gem 
rm bundler-1.3.0.gem 
@lucasmartins
Copy link

I'm considering making a ruby-build recipe for rbenv, do you know a quick way I could test the Ruby VM after is has been compiled for dtrace support?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment