rvmでRuby 2.0.0をMac OSX Lionに入れるときに

ちなみにbrewも使ってる場合です。
普通にインストールするとエラーになった。

$ rvm install 2.0.0

ここ(https://github.com/wayneeseguin/rvm/issues/1290)にあるようにするとインストールできるっぽいのでやってみる。

$ rvm install 2.0.0 --skip-openssl --with-opt-dir="`brew --prefix openssl`"

....省略
Error running 'make', please read /Users/hironemu/.rvm/log/ruby-2.0.0-p0/make.log
There has been an error while running make. Halting the installation.

だめぽ。ログをみてみるとなんかOpenSSLのディレクトリがないっぽい。

ld: warning: directory not found for option '-L/usr/local/Cellar/openssl/1.0.1c/lib'

brew --prefix openssl」の結果をみてみると確かに、/usr/local/Cellar/openssl/1.0.1cと表示される。どこからでてきたのこれ。ばぐなの?なおってるの?

https://github.com/mxcl/homebrew/issues/12571

とりあえず先にbrew installで最新のものを入れておく

$ brew install openssl

そしてもう一度Rubyのインストール

$ rvm install 2.0.0 --skip-openssl --with-opt-dir="`brew --prefix openssl`"

あれ、まだだめ。よく見たら違うところがエラー

/Users/hironemu/.rvm/src/ruby-2.0.0-p0/lib/fileutils.rb:111: [BUG] Stack consistency error (sp: 38, bp: 36)
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]

以下のサイトにCC=clangをつけろというのがあったのでやってみる。
http://stackoverflow.com/questions/15055457/error-while-installing-ruby2-with-rvm

$ CC=clang rvm install 2.0.0 --skip-openssl --with-opt-dir="`brew --prefix openssl`"                                                     ~
Installing Ruby from source to: /Users/hironemu/.rvm/rubies/ruby-2.0.0-p0, this may take a while depending on your cpu(s)...
ruby-2.0.0-p0 - #downloading ruby-2.0.0-p0, this may take a while depending on your connection...
ruby-2.0.0-p0 - #extracted to /Users/hironemu/.rvm/src/ruby-2.0.0-p0 (already extracted)
ruby-2.0.0-p0 - #configuring
ruby-2.0.0-p0 - #compiling
ruby-2.0.0-p0 - #installing 
Retrieving rubygems-2.0.0
######################################################################## 100.0%
Extracting rubygems-2.0.0 ...
Removing old Rubygems files...
Installing rubygems-2.0.0 for ruby-2.0.0-p0 ...
Installation of rubygems completed successfully.
Saving wrappers to '/Users/hironemu/.rvm/bin'.
ruby-2.0.0-p0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-2.0.0-p0 - #importing default gemsets, this may take time ...
Install of ruby-2.0.0-p0 - #complete 

やったでけた。

確認

$ rvm use 2.0.0
Using /Users/hironemu/.rvm/gems/ruby-2.0.0-p0
$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]

おけ。