&tag(RVM); *目次 [#pe269018] #contents *参考情報 [#qc4c7c9a] -[[RVM: Ruby Version Manager - RVM Ruby Version Manager - Documentation:http://beginrescueend.com/]]…公式 *基本 [#g7ec308e] -複数のRubyを使い分けるための仕組み。 -ユーザーディレクトリ内部にインストールするのでsudoしなくて良い。 *インストール [#q540c475] -[[RVM: Ruby Version Manager - RVM Ruby Version Manager - Documentation:http://beginrescueend.com/]]に書いてある手順で実行する。 -RVMをインストールする $ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) -.bash_profileに環境設定が追加される(zshの場合.zshrcなどに移動しておく)。 [[ -s "/Users/tanaka/.rvm/scripts/rvm" ]] && source "/Users/tanaka/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* -評価する。 $ source ~/.bash_profile -必要要件などを表示する。 $ rvm requirements *gemset [#ubc4338a] **gemsetとは何か [#we0a8da4] -[[RVM: Ruby Version Manager - Gemset Basics:https://rvm.beginrescueend.com/gemsets/basics/]] -1つのRubyバージョンに対して複数のgemsetと呼ばれる環境を作って切り替えることができる(1.9.3@aとか、1.9.3@bとか)。 *Tips [#m47e3c49] **shebangはどうなる? [#md146c34] -今まで#!/usr/local/bin/rubyとか#!/usr/bin/rubyとか書いていた場合次のように変更する(システムワイドで入れれば不要?) #!/usr/bin/env ruby -次のようなスクリプトで確認できる。 #pre{{ #!/usr/bin/env ruby puts RUBY_DESCRIPTION }} *トラブルシューティング [#tb5a2ea7] **Xcode4.3を使うといろいろトラブル [#q2a412e7] -Xcode4.3/MacPorts/opensslなどのからみでトラブルてんこもりだった。 -[[Ruby 1.9.3 + Rails 3.2.1 で segmentation fault -> 解決 - さとうようぞうのblog:http://webcache.googleusercontent.com/search?q=cache:8cyJ2lNWdVYJ:somethingnew2.com/blog/archives/2012/02/ruby_193_rails_321_segmentation_fault.php+http.rb+segmentation+fault&cd=2&hl=ja&ct=clnk&gl=jp]]によると次の手順でインストールする。 #pre{{ $ rvm pkg install iconv $ rvm pkg install openssl $ rvm install ruby-1.9.3-p125 --with-openssl-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr }} …これでいくかと思ったがrvm pkg installがうまく動かずだめ。 -osx-gcc-installerが必要?xcodeと同時にいれても大丈夫?