2013年11月4日 星期一

ERROR: Failed to build gem native extension. /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby extconf.rb

依ihower的Ruby on Rails 實戰聖經
最後步驟是:gem install sqlite3和gem install rails
在OSX 10.8.5安裝時出現這錯誤訊息
看到stackoverflow有人說XCode 4以後要自己裝Command Line tools
才解決問題,想說在之前在Ubuntu裝都好好的@.@
打開XCode後到Preferences -> Downloads -> Components
下載並安裝
Command Line tools

錯誤訊息:

ERROR: Failed to build gem native extension.
    /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby extconf.rb

checking for sqlite3.h... *** 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.

REF:http://stackoverflow.com/questions/8389301/os-x-rails-failed-to-build-gem-native-extension

P.S.
OSX 10.9之後可以使用"xcode-select --install”,不用透過GUI慢慢選
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html