使用rvm和brew在Mac OS X上安装hpricot

时间:2010-10-03 15:18:28

标签: ruby macos rvm homebrew

在Mac OS X上安装hpricot时遇到问题。我怀疑它可能是rvm和brew之间的问题?

rvm 1.0.5 酿造0.7

思考?建议?谢谢!

$ gem install hpricot
Building native extensions.  This could take a while...
ERROR:  Error installing hpricot:
    ERROR: Failed to build gem native extension.

/Users/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby extconf.rb
checking for stdio.h... no
*** 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=/Users/dhaskin/.rvm/rubies/ruby-1.8.7-p302/bin/ruby


Gem files will remain installed in /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2 for inspection.
Results logged to /Users/dhaskin/.rvm/gems/ruby-1.8.7-p302/gems/hpricot-0.8.2/ext/fast_xs/gem_make.out

2 个答案:

答案 0 :(得分:0)

ERROR: Failed to build gem native extension.checking for stdio.h... no是可疑的。 Hpricot以及许多其他Ruby宝石需要编译一些代码,如果缺少开发包,它将失败。

你正在你的机器上运行RVM和1.8.7在〜/ .rvm中,所以看起来它是因为RVM必须编译Ruby,但是失败听起来并非如此。你在/ Developer目录中安装了Apple的XCode吗?如果您没有安装和/或目录不存在,您可以在MacOS安装光盘或Apple开发者网站上找到安装程序:http://developer.apple.com/technologies/xcode.html

除此之外,我建议使用Nokogiri而不是Hpricot。我在Hpricot遇到了几个错误,使得它无法满足我的需求,并转向Nokogiri。你会发现这两个宝石的语法相似。 http://nokogiri.org/

答案 1 :(得分:0)

原来这是一个XCode版本依赖。将XCode更新为3.2.4解决了这个问题。

相关问题