Mac OS X を 10.9 Mavericks にバージョンアップした後に、Rails プロジェクトのbundle install
が失敗するようになったので、その対処法です。
環境は、rbenv, ruby 2.0.0-p353, Rails 4.0.2 です。
結論から書いておきますと、xcode-select --install
してコマンドラインツールをインストールした後に再実行したら解決しました。
エラーログ
具体的には私の環境では、atomic gem のインストールに失敗するようになりました。C拡張周りのgemをインストールしようとすると同じ症状となるので、他の方々もいろいろなところでこけていたようです。
以下エラー発生時のログです。
$ bundle install
...
省略
...
Installing activerecord-deprecated_finders (1.0.3)
Installing tzinfo (0.3.38)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/.rbenv/versions/2.0.0-p353/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/.rbenv/versions/2.0.0-p353/bin/ruby
--with-atomic_reference-dir
--without-atomic_reference-dir
--with-atomic_reference-include
--without-atomic_reference-include=${atomic_reference-dir}/include
--with-atomic_reference-lib
--without-atomic_reference-lib=${atomic_reference-dir}/
/.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:430:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:515:in `try_link0'
from /.rbenv/versions/2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:813:in `try_run'
from extconf.rb:26:in `<main>'
Gem files will remain installed in /rails-project/vendor/bundle/ruby/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to /rails-project/vendor/bundle/ruby/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
...
省略
...
対処法
対処法はxcode-select --install
してコマンドラインツールをインストール後に再実行。