Nokogiri 1.5.9宝石在Mac OS X Mavericks上无法安装?

5
上晚我系统升级到了Maverick,现在我无法从我的gemfile安装Nokogiri。它报错说找不到libxml2,但是Maverick自带libxml2。我也尝试过其他方法。
brew install --development libxml2

同时:

brew install --development libxslt

我仍然看到相同的错误消息。我已经粘贴了下面的错误消息,请有人看一下并告诉我接下来应该尝试什么?

mapte:config-renderer mapte$  gem install nokogiri -v '1.5.9'
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

        /usr/local/var/rbenv/versions/1.9.2-p180/bin/ruby extconf.rb
checking for libxml/parser.h... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html             for help with installing dependencies.
-----
*** 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=/usr/local/var/rbenv/versions/1.9.2-p180/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


Gem files will remain installed in /usr/local/var/rbenv/versions/1.9.2-
p180/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.9 for inspection.
Results logged to /usr/local/var/rbenv/versions/1.9.2-p180/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.9/ext/nokogiri/gem_make.out 

很可能是Jackling建议的,更新开发工具xcode-select --install - davegson
2个回答

4

对于我来说,我需要安装开发者工具:

  xcode-select --install

请确保打开Xcode应用程序并接受许可证。
我尝试从命令行中执行,但无法成功。


3
首先要检查的是您的/usr/include目录是否不为空或缺少libxml2.h文件,并考虑使用符号链接或其他方式将Xcode SDK /usr/include暴露给Homebrew进程:
以下是应用商店版本,但如果提供了parser.h文件,可以根据需要调整beta/预发布/GM/旧版本的Xcode路径:
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2/libxml/parser.h

下一步是确保Homebrew已经更新到最新版本,按照以下三个步骤进行操作:
 brew update
 brew outdated
 brew upgrade

这时,你可能需要根据你在问题中粘贴的输出,准确地列出mkmf.log文件中的错误消息。


检查了我的 /usr/include 目录,所有的库都在那里。Brew 已经完全更新,所有过时的公式都已升级。Xcode 已更新,命令行工具已安装。但还是没有运气,仍然抱怨缺少 libxml2。 - Pop-A-Stash
你有查看错误吗?我编辑了我的回答,因为我的要求细节显然太模糊了。 - bmike
我不能告诉你我是怎么修复它的,因为我真的不知道。不幸的是,这个页面上列出的答案都不是正确的。 - Pop-A-Stash

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接