OSX 10.9 MaverickにNokogiriをインストールする際のエラー?
OSX(Lion)をMavericksにアップグレードしたら、プロジェクト用のNokogiriをインストールできなくなりました‼。
XCode 5.0.1, Command Line Tools (using xcode-select --install
) をインストールし、Homebrewからlibxml2をインストールしましたが、まだ問題が残っています。
というエラーが出ます。
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
checking for libxml/parser.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.
Provided configuration options:
--with-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=/Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-libxslt-config
--without-libxslt-config
--with-pkg-config
--without-pkg-config
--with-libxml-2.0-config
--without-libxml-2.0-config
--with-libiconv-config
--without-libiconv-config
/Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/ericcamalionte/.rvm/rubies/ruby-1.9.2-p320/lib/ruby/1.9.1/mkmf.rb:852:in `find_header'
from extconf.rb:116:in `<main>'
Gem files will remain installed in /Users/ericcamalionte/Locaweb/code/dns-panel/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.9 for inspection.
Results logged to /Users/ericcamalionte/Locaweb/code/dns-panel/vendor/bundle/ruby/1.9.1/gems/nokogiri-1.5.9/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.5.9), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.5.9'` succeeds before bundling.
Homebrewからlibxml2, libxslt, libiconvをインストールし、Nokogiriをインストールするようにparamsを設定しましたが、don'もうまくいきません。
私の環境では何が問題なのかがわかりません、助けてください。
108
3
Mac OS X 10.9 MavericksにNokogiriをインストールするには、XCodeのフルインストールが必要です。
アップデート
Yosemite**をお使いの方は、以下のコマンドで動作します。
とか、とにかく実際には
MacOSX10.11.sdk
フォルダに入っているかもしれないので(私のは2015年9月18日時点)、まだEl Capitanに完全アップしていなくても、最近XCodeをアップデートしていたので、次に続くEl Capitan SDKのパスを使う必要があるかもしれませんね。アップデート
El Capitan**をお使いの方は、以下のコマンドで動作します。
アップデート
Sierra**をお使いの方は、以下のコマンドで動作します。
このログを見ると、gcc-4.2が見つかっていないことがわかりました。
この問題を解決するために、私は homebrew
brew install apple-gcc42
を使って apple-gcc42 をインストールし、私の /usr/bin にシンボリックリンクを作りました。sudo ln -s /usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 /usr/bin/gcc-4.2
とする。Mavericksを新規にインストールした際に、これと同じエラーが発生しました。判断に迷った末に、Xcodeのアプリバンドル名を
Xcode 5.0.1.app
に変更しました。どうやらNokogiriのインストールスクリプトはパスを引用しないので、ファイル名にスペースがあるといろいろと面倒なことになるようだ。このエラーが明らかになったのは、
brew install libxml2
を試してみてからです。教訓:ファイル名のスペースは悪である。