rvmでruby 1.9.3-p362をインストールする



$ rvm install ruby-1.9.3-p362 --with-openssl-dir=$rvm_path/usr
Installing Ruby from source to: /Users/masato1/.rvm/rubies/ruby-1.9.3-p362, this may take a while depending on your cpu(s)...
ruby-1.9.3-p362 - #downloading ruby-1.9.3-p362, this may take a while depending on your connection...
ruby-1.9.3-p362 - #extracted to /Users/masato1/.rvm/src/ruby-1.9.3-p362 (already extracted)
ruby-1.9.3-p362 - #configuring
ruby-1.9.3-p362 - #compiling
Error running 'make', please read /Users/masato1/.rvm/log/ruby-1.9.3-p362/make.log
There has been an error while running make. Halting the installation.

ログを見てみるとコンパイラでclangが使われているのがダメらしい。確かに、rvm requirementsコマンドで確かめてみると、

$ rvm requirements

Xcode and gcc:

Right now Ruby requires gcc to compile, but Xcode 4.2 and later no longer ship with gcc. Instead they ship with llvm-gcc (to which gcc is a symlink) and clang, neither of which are supported for building Ruby. Xcode 4.1 was the last version to ship gcc, which was /usr/bin/gcc-4.2.

rvm requirements によると、

For Ruby 1.9.3: Install libksba # If using Homebrew, 'brew install libksba'


Xcode 4.2 and later (including Command Line Tools for Xcode):
- If you have gcc-4.2 (and friends) from an earlier Xcode version, Ruby will build fine.
- If you don't have gcc-4.2, you have two options to get it:
 * Install apple-gcc42 from Homebrew
 * Install osx-gcc-installer


  If you are using Homebrew, you can install the apple-gcc42 and required libraries from homebrew/dupes:

      brew update
      brew tap homebrew/dupes
      brew install autoconf automake apple-gcc42
      rvm pkg install openssl

  Xcode 4.2+ install or/and Command Line Tools for Xcode is required to provide make and other tools.


$ brew update
$ brew tap homebrew/dupes
$ brew install libksba
$ brew install autoconf automake apple-gcc42



$ CC=gcc-4.2 rvm install ruby-1.9.3-p362 --with-openssl-dir=$rvm_path/usr