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 homebrew i prefer to use the homebrew one.

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

ruby -e "$(curl -fsSL"
brew install rbenv
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 containing the sources.

mkdir ~/temp && cd ~/temp
curl -L | 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 I chose 9 as I have eight cores (n of cores + 1).

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.

gem install bundler-1.3.0.gem
rm bundler-1.3.0.gem

comments powered by Disqus