March 02, 2013

Installing Ruby 2.0.0 and Rails 4.0.0 beta 1 on Mountain Lion with RVM

Celebrating Ruby's 20th anniversary, both Ruby 2.0.0 and Rails 4.0.0 beta 1 were released last week. Naturally, we will want to get playing with these new tools right away, but installation has not been straightforward for some.

Here's how I (eventually) managed to get the pair running on OS X Mountain Lion:

Install dependancies

Most of these problems seem to revolve around the openssl dependancy and RVM's default process for upgrading it. To install and use openssl 1.0.1e successfully, I found homebrew did the trick. Follow these steps to install it (and libyaml, the other dependancy).

$ brew update
...
$ brew install libyaml openssl

Update RVM

We need to upgrade RVM to install Ruby 2.0.0.

$ rvm get head

Install Ruby 2.0.0

You may be reading this because you've already tried installing it, so let's take some precautionary cleanup measures.

$ rvm remove ruby 2.0.0
...
$ rvm pkg remove

Now you should be ready to install and use Ruby 2.0.0:

$ rvm install ruby
...
$ rvm use 2.0.0

Check for any error messages in the log. At this point, there should be none.

Install Rails 4

As it's still in beta, you'll need to specify the version of the Rails gem to install:

$ gem install rails --version 4.0.0.beta1 --no-ri --no-rdoc

Again, this should now install faultlessly. Let me know if you have any problems.