最初に結論
Mac10.7.3, Xcode4.2.x, Ruby1.9.3 この辺の組み合わせが災いのもと。
インストールするだけなのにいろいろややこしすぎるぞヽ(`Д´)ノウワァァァン
でもがんばる。
Xcode も最新ものに
Xcode4.2.x とかなら Xcode4.3.x とか最新のものにアプデートしとく
手順まとめ: MacOSX10.7 に RVM で Ruby1.9.3 と Rails3.2.3 をインストール
下記サイトが解りやすい(以下引用、若干変更)
Xcode
最新にしとく(今現在4.3.2)
Install: Command Line Tools
Xcode のメニュー Xcode -> Preferences、Download で出てこない場合、下記リンクからダウンロードしてインストール
Xcodeの参照先確認
$ xcode-select -print-path /Developer $ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer Password: $ xcode-select -print-path /Applications/Xcode.app/Contents/Developer
Install: RVM
curl -L get.rvm.io | bash -s stable source ~/.rvm/scripts/rvm
.bashrc
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
rvm requirements
$ rvm requirements Notes for Mac OS X 10.7.4, Xcode 4.3.2. 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 pFor 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.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.
Install: libksba
sudo port install libksba
Install: openssl, iconv and readline
ほか必要なパッケージもインストール
rvm pkg install openssl rvm pkg install iconv rvm pkg install readline
証明書の位置確認
$ ruby -ropenssl -e 'p OpenSSL::X509::DEFAULT_CERT_FILE' "~/.rvm/usr/ssl/cert.pem"
証明書を置く
$ sudo cp /opt/local/share/curl/curl-ca-bundle.crt ~/.rvm/usr/ssl/cert.pem $ sudo chown <USERNAME> ~/.rvm/usr/ssl/cert.pem
Install: Ruby1.9.3
なぜかオプション付けるとエラー出た
$ rvm install 1.9.3-p194 --with-iconv-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-readline-dir=$rvm_path/usr --with-gcc=clang Fetching yaml-0.1.4.tar.gz to /Users/username/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/username/.rvm/src Error running 'tar xmzf /Users/username/.rvm/archives/yaml-0.1.4.tar.gz -C /Users/username/.rvm/src ', please read /Users/username/.rvm/log/ruby-1.9.3-p194/yaml/extract.log Configuring yaml in /Users/username/.rvm/src/yaml-0.1.4. Error running ' ./configure --prefix="/Users/username/.rvm/usr" --with-iconv-dir=/Users/username/.rvm/usr --with-openssl-dir=/Users/username/.rvm/usr --with-readline-dir=/Users/username/.rvm/usr --with-gcc=clang ', please read /Users/username/.rvm/log/ruby-1.9.3-p194/yaml/configure.log Compiling yaml in /Users/username/.rvm/src/yaml-0.1.4. Installing yaml to /Users/username/.rvm/usr Installing Ruby from source to: /Users/username/.rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)... ruby-1.9.3-p194 - #fetching ruby-1.9.3-p194 - #extracted to /Users/username/.rvm/src/ruby-1.9.3-p194 (already extracted) ruby-1.9.3-p194 - #configuring ruby-1.9.3-p194 - #compiling Error running 'make ', please read /Users/username/.rvm/log/ruby-1.9.3-p194/make.log There has been an error while running make. Halting the installation. ls: /Users/username/.rvm/rubies/*/bin/ruby: No such file or directory
もうやけっぱちでオプションなしでやってみた
$ rvm install 1.9.3-p194 Fetching yaml-0.1.4.tar.gz to /Users/username/.rvm/archives Extracting yaml-0.1.4.tar.gz to /Users/username/.rvm/src Error running 'tar xmzf /Users/username/.rvm/archives/yaml-0.1.4.tar.gz -C /Users/username/.rvm/src ', please read /Users/username/.rvm/log/ruby-1.9.3-p194/yaml/extract.log Configuring yaml in /Users/username/.rvm/src/yaml-0.1.4. Error running ' ./configure --prefix="/Users/username/.rvm/usr" ', please read /Users/username/.rvm/log/ruby-1.9.3-p194/yaml/configure.log Compiling yaml in /Users/username/.rvm/src/yaml-0.1.4. Installing yaml to /Users/username/.rvm/usr Installing Ruby from source to: /Users/username/.rvm/rubies/ruby-1.9.3-p194, this may take a while depending on your cpu(s)... ruby-1.9.3-p194 - #fetching ruby-1.9.3-p194 - #extracted to /Users/username/.rvm/src/ruby-1.9.3-p194 (already extracted) ruby-1.9.3-p194 - #configuring ruby-1.9.3-p194 - #compiling ruby-1.9.3-p194 - #installing Retrieving rubygems-1.8.24 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 371k 100 371k 0 0 451k 0 --:--:-- --:--:-- --:--:-- 1320k Extracting rubygems-1.8.24 ... Removing old Rubygems files... Installing rubygems-1.8.24 for ruby-1.9.3-p194 ... Installation of rubygems completed successfully. ruby-1.9.3-p194 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.3-p194 - #importing default gemsets (/Users/username/.rvm/gemsets/) Install of ruby-1.9.3-p194 - #complete $ rvm list rvm rubies =* ruby-1.9.3-p194 [ x86_64 ] # => - current # =* - current && default # * - default
なぜかインストールできた。まあいいか、よしとしよう。えらいぞ俺様、よくやった。
感想
Ruby1.9.3 と Rails3.2.3 をインストールしたいだけなのに、何でこんなに複雑怪奇で面倒な事になるのか。なぜなの?