2012年5月20日日曜日

MacにrvmでRubyをインストール

■rvmのインストール

$ curl -L get.rvm.io | bash -s stable
$ source ~/.rvm/scripts/rvm


■Rubyのインストールに当たって必要事項

$ rvm requirements

  Notes for Mac OS X 10.7.4, Xcode 4.2.1.

For MacRuby: Install LLVM first.

For JRuby:  Install the JDK. See http://developer.apple.com/java/download/  # Current Java version "1.6.0_26"
For IronRuby: Install Mono >= 2.6
For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba'

You can use & download osx-gcc-installer: https://github.com/kennethreitz/osx-gcc-installer
** NOTE: Currently, Node.js is having issues building with osx-gcc-installer. The only fix is to install Xcode over osx-gcc-installer.

We had reports of http://hpc.sourceforge.net/ making things work, but it looks like not easiest/safest to setup.

To use an RVM installed Ruby as default, instead of the system ruby:

    rvm install 1.8.7 # installs patch 357: closest supported version
    rvm system ; rvm gemset export system.gems ; rvm 1.8.7 ; rvm gemset import system.gems # migrate your gems
    rvm alias create default 1.8.7

And reopen your terminal windows.

Xcode 4.2:
 * is only supported by ruby 1.9.3+
 * it breaks gems with native extensions, especially DB drivers.

Xcode 4.2.1+ users - please be warned -
in case of any compilation issues
 * downgrade to Xcode 4.1
 * uninstall Xcode and install osx-gcc-installer
and reinstall your rubies.

■Rubyの一覧

$ rvm list known

  ■Ruby 1.9.3 をインストール(このときはruby-1.9.3-p194がインストールされた)

$ rvm install 1.9.3

■使用できるRubyの一覧

$ rvm list

■インストールしたRubyを使うように設定

$ rvm use ruby-1.9.3-p194
Using /Users/username/.rvm/gems/ruby-1.9.3-p194
$ which ruby
/Users/username/.rvm/rubies/ruby-1.9.3-p194/bin/ruby

■デフォルトのRubyに戻す場合

$ rvm use system
Now using system ruby.
$ which ruby
/usr/bin/ruby

0 件のコメント:

コメントを投稿