Ruby 2 on OS X Mountain Lion

[Updated for Ruby 2.0.0-rc1 on 10 January 2013]

Ruby 2.0 release candidate 1 is out! If you're like me you want to try out the new
shiny stuff before it's all done, you can install it now easily with
rbenv and Homebrew.

Warning

My first attempts at installing failed (quietly). Things seemed to
work, but I found this in the configure output:

OS X ships with an older version of OpenSSL. Even in Mountain Lion.
Homebrew makes it easy to install a new version, but does so cautiously;
after you install OpenSSL, Homebrew displays a message detailing that it
did not automatically link it. I chose to link it, but as a result I
went and recompiled all of my rubies with rbenv and the new OpenSSL. You may or may not need
to do this. It may or may not break other things. Be warned.

Installing

I assuming you're using rbenv, Homebrew, and an updated
OpenSSL.

  1. Download and extract the preview release: ruby-2.0.0-rc1.tar.bz2
  2. With your favorite shell, navigate to the extracted folder and configure -> make -> make install. You need to set the --prefix flag to install it along your other rbenv rubies:
    ~❯ cd ~/Downloads/ruby-2.0.0-rc1
    ruby-2.0.0-rc1 ❯ ./configure --prefix=$HOME/.rbenv/versions/2.0.0-rc1
    checking build system type... x86_64-apple-darwin12.2.0 ... ... config.status: creating ruby-2.0.pc ruby-2.0.0-rc1 ❯ make ... ... Elapsed: 0.1s ruby-2.0.0-rc1 ❯ make install ... ... ruby-2.0.0-rc1 ❯
  3. $\$\$ Profit $$$

You can now use Ruby 2.0 via rbenv:

ruby-2.0.0-rc1 ❯ rbenv local 2.0.0-rc1 
ruby-2.0.0-rc1 ❯ ruby -v
ruby 2.0.0dev (2013-01-07 trunk 38733) [x86_64-darwin12.2.1]

Done. Have fun storming the castle.

@ctshryock

About

My name is Clint Shryock. I develop things in Go and Ruby. I live in central Missouri, where the weather is beautiful 4 months of the year.
+-----------------+
|                       |
|      (ノ^_^)ノ      |
|                       |
|   ☜(゚ヮ゚☜)    |
|                       |
|     ౿(ఠ_ఠఎ)    |
|                       |
|        ಠ_ಠ         |
x                      x
  xxx           xxx
       xx    xx
           xx