RVM: Ruby Version Manager - Installing RVM
ここに従う
まずおもむろにターミナルを起動して
$ cd
でとりあえずホームディレクトリに移動する
$ curl -L get.rvm.io | bash -s stable
ぶっこんでインストール用のスクリプトのダウンロードと実行をやる
$ curl -L get.rvm.io | bash -s stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 9249 100 9249 0 0 3500 0 0:00:02 0:00:02 --:--:-- 4487 Downloading RVM from wayneeseguin branch stable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1045k 100 1045k 0 0 243k 0 0:00:04 0:00:04 --:--:-- 520k Installing RVM to /Users/hoge/.rvm/ Adding rvm PATH line to /Users/hoge/.bashrc /Users/hoge/.zshrc. Adding rvm loading line to /Users/hoge/.bash_profile /Users/hoge/.zlogin. # RVM: Shell scripts enabling management of multiple ruby environments. # RTFM: https://rvm.io/ # HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net) # Cheatsheet: http://cheat.errtheblog.com/s/rvm/ # Screencast: http://screencasts.org/episodes/how-to-use-rvm # In case of any issues read output of 'rvm requirements' and/or 'rvm notes' Installation of RVM in /Users/hoge/.rvm/ is almost complete: * To start using RVM you need to run `source /Users/hoge/.rvm/scripts/rvm` in all your open shell windows, in rare cases you need to reopen all shell windows.
こんな感じでホームディレクトリの.rvm
にインストールされて環境用のスクリプトも書いてくれたみたい
スクリプトがあるからそれ読み込んでbashのターミナルを立ち上げ直せって書いてあるからそれに従う
$ source .rvm/scripts/rvm
なんかrvm系のコマンドがたくさん使えるようになった。
今回のバージョンは rvm 1.14.1
それではインストールできるRubyを探る
$ rvm list known # MRI Rubies [ruby-]1.8.6[-p420] [ruby-]1.8.7[-p358] [ruby-]1.8.7-head [ruby-]1.9.1[-p431] [ruby-]1.9.2-p180 [ruby-]1.9.2-p290 [ruby-]1.9.2-p318 [ruby-]1.9.2[-p320] [ruby-]1.9.2-head [ruby-]1.9.3-preview1 [ruby-]1.9.3-rc1 [ruby-]1.9.3-p0 [ruby-]1.9.3-p125 [ruby-]1.9.3[-p194] [ruby-]1.9.3-head ruby-head # GoRuby goruby # TheCodeShop - MRI experimental patches tcs # JRuby jruby-1.2.0 jruby-1.3.1 jruby-1.4.0 jruby-1.6.5 jruby-1.6.5.1 jruby-1.6.6 jruby-1.6.7 jruby[-1.6.7.2] jruby-head jruby-1.7.0.preview1 # Rubinius rbx-1.0.1 rbx-1.1.1 rbx-1.2.3 rbx-1.2.4 rbx[-head] rbx-2.0.testing # Ruby Enterprise Edition ree-1.8.6 ree[-1.8.7][-2012.02] # Kiji kiji # MagLev maglev[-head] maglev-1.0.0 # Mac OS X Snow Leopard Or Newer macruby-0.10 macruby[-0.11] macruby-nightly macruby-head # IronRuby -- Not implemented yet. ironruby-0.9.3 ironruby-1.0-rc2 ironruby-head
うむ色々入れられそうだ。では早速定番の1.8.7を入れる
$ rvm install 1.8.7
そうしたら
The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.
こんな赤文字が出た。
なんかよくわからんが
$ rvm requirements
を読めと
見たところ
お前のコンパイラ/user/bin/gccはLLVMを利用するものになっていてrubyではそのコンパイラはサポートしてないよ
とのことだ。
LLVMってのはコンパイラ用のフレームワークみたいなもんで、LLVM向けに作るといろいろ勝手に最適化してくれる便利なものみたいだ。 とにかくXcode付属のコンパイラはLLVM系に移行してきていてあんたの指定したバージョンのRubyはコンパイルできないよということか。
確認してみると
$ ls -l /usr/bin/gcc lrwxr-xr-x 1 root wheel 12 5 24 21:58 /usr/bin/gcc -> llvm-gcc-4.2
となっていた。
確かにllvm系のコンパイラのようだ。
Xcode 4.3+ users - please be warned - only ruby-1.9.3-p125+ is partially supported - in case of any compilation issues: * downgrade to Xcode 4.1 * uninstall Xcode and install osx-gcc-installer and reinstall your rubies.
うむ・・・この状況だと1.8.7は入れられないようだ。面倒だな。
そこまでしてRVM管理でRuby入れてもしょうがねーのでLion付属のRuby1.8.7とRVM管理の1.9.3でやってみる
1.9.3のインストール
rvm install 1.9.3
$ ruby --version ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
OK.
Lion付属の1.8.7に切り替える
$ rvm system
$ ruby --version ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
2012-06-01 新規