rvm から rbenv 移行だけだったのだが、homebrew おかしかったりといろいろ手間かかった。
- rvm をアンインストール
- homebrew update のエラーの対処
- rbenv をインストール
- rbenv で Ruby を 2.0.0 にする
1. rvm をアンインストール
1 2 | # rvm 削除 $ rvm implode |
2. homebrew update のエラー対処
rbenv の動作には、homebrew で apple-gcc42 を入れる必要がある。
Mac に最初から入っている gcc では正常動作しないようだ。
参照: http://d.hatena.ne.jp/enerick/20120228/1330429199
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # brew update がエラーになるのでそこから追求 # そもそも、/usr/local の権限 root になっている $ cd /usr/local $ ls -dl # /usr/local の権限変更 $ sudo chown -R [USER NAME] /usr/local # git add して stash する $ git add . $ git stash # 最後はこれ $ brew update $ brew tap homebrew/dupes # 必要なものをインストール $ brew install apple-gcc42 $ brew install openssl |
3. rbenv をインストール (ruby-build も入れちゃおう)
1 2 3 4 5 | $ mkdir ~/.rbenv # cd ~/.rbenv $ git clone https://github.com/sstephenson/rbenv.git $ mkdir -p ~/.rbenv/plugins $ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build |
PATH を通す
1 2 | export PATH="/Users/[USER NAME]/.rbenv/bin:$PATH" eval "$(rbenv init -)" |
4. rbenv で Ruby を 2.0.0 にする
参照: http://qiita.com/items/9dd797f42e7bea674705
1 2 3 4 5 6 | # 2.0.0-rc2 をインストール # rbenv install 2.0.0-rc2 で良い $ RUBY_CONFIGURE_OPTS="--enable-shared --with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl)" rbenv install 2.0.0-rc2 # version を切替る $ rbenv global 2.0.0-rc2 |