rvmからrbenvへ乗り換えにちょっと苦労した
まずは rbenvと必要なものをインストール。このころはさくっと終わると思っていました。。
brew install rbenv ruby-build rbenv-gem-rehash readline
で、rubyをinstallしようとしたが失敗。
takayukishimizu-no-MacBook-Pro:trabby takayuki$ rbenv install 2.0.0-rc2 Downloading ruby-2.0.0-rc2.tar.gz... -> http://dqw8nmjcqpjn7.cloudfront.net/9d5e6f26db7c8c3ddefc81fdb19bd41a Installing ruby-2.0.0-rc2... BUILD FAILED Inspect or clean up the working tree at /var/folders/7z/5nqy88hd35j8q35jkt3hgbsh0000gn/T/ruby-build.20131210192317.25684 Results logged to /var/folders/7z/5nqy88hd35j8q35jkt3hgbsh0000gn/T/ruby-build.20131210192317.25684.log Last 10 log lines: installing default gems: /Users/takayuki/.rbenv/versions/2.0.0-rc2/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications) bigdecimal 1.1.0 io-console 0.4.1 json 1.7.5 minitest 4.3.2 psych 2.0.0 rake 0.9.6 rdoc 4.0.0.rc.2.1 test-unit 2.0.0.0 The Ruby openssl extension was not compiled. Missing the OpenSSL lib?
http://nick.hateblo.jp/entry/2013/06/12/232300 をみて足りないものを入れる
brew install openssl
そしたらまたエラー
curl: (7) couldn't connect to host Error: Download failed: http://openssl.org/source/openssl-1.0.1e.tar.gz
ぐぐるとこれがでてきたので、FIX: Error: Download failed: http://openssl.org/source/openssl... https://gist.github.com/devinbrown/5073115
brew edit openssl
してmirrorサイトに切り替える。
require 'formula' class Openssl < Formula homepage 'http://openssl.org' url 'http://mirrors.ibiblio.org/openssl/source/openssl-1.0.1e.tar.gz' ...
でもういっちょトライ。
brew install openssl
イケタ! ので再チャレンジ!
rbenv install 2.0.0-rc2
・・・\(^o^)/
さっきと同じエラー・・・ あ、よく記事をみると依存ライブラリを指定するらしい。
RUBY_CONFIGURE_OPTS="--with-readline-dir=`brew --prefix readline` --with-openssl-dir=`brew --prefix openssl`" rbenv install 2.0.0-rc2
・・・・(´・ω・`)・・・・
いけた!
この状態だとsystemのrubyが使われるので、いれたrubyをデフォルトに指定。
rbenv global 2.0.0-rc2
rvmのuninstallは切腹と打てばいいそう。
rvm seppuku
bash_profileにあったrvmの記述も忘れずに消す。
全部gemがなくなっちゃったみたいだから地道にいれなおす。
$ bundle install Fetching source index from https://rubygems.org/ Could not verify the SSL certificate for https://rubygems.org/. There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit your Gemfile sources and change 'https' to 'http'.
また怒られました(´・ω・`)
またググると Installing Ruby 2.0 - Benjamin Curtis http://www.bencurtis.com/2013/08/installing-ruby-2-dot-0/ とあって、たしかにssl入れた時にcurl-ca-bundle入れろよって言われてスルーしてたなと反省しつつ
$ brew install curl-ca-bundle
~/.bash_profileに追記
$ export SSL_CERT_FILE=/usr/local/opt/curl-ca-bundle/share/ca-bundle.crt
したあとbundle install するとやっと成功。
SSL_connect returned=1 errno=0 state=SSLv3 read server key exchange B: bad ecpoint
とコケていたのも解決されました。