我无法在运行Mountain Lion的Mac上安装Nokogiri。
我尝试使用命令安装它:
gem install nokogiri -v '1.6.0'
我得到这个输出:
Building native extensions. This could take a while...
/usr/local/Cellar/ruby193/1.9.3-p448/lib/ruby/1.9.1/rubygems/ext/builder.rb:48: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/usr/local/Cellar/ruby193/1.9.3-p448/bin/ruby extconf.rb
/usr/local/Cellar/ruby193/1.9.3-p448/lib/ruby/gems/1.9.1/gems/mini_portile-0.5.1/lib/mini_portile.rb:215: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /usr/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin12.5.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... OK
Running 'compile' for libxslt 1.1.26... OK
Running 'install' for libxslt 1.1.26... OK
Activating libxslt 1.1.26 (from /usr/local/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.26)...
checking for libxml/parser.h... yes
checking for libxslt/xslt.h... yes
checking for libexslt/exslt.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for exsltFuncRegister() in -lexslt... yes
checking for xmlHasFeature()... yes
checking for xmlFirstElementChild()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetParserStructuredErrors()... yes
checking for xmlRelaxNGSetValidStructuredErrors()... yes
checking for xmlSchemaSetValidStructuredErrors()... yes
checking for xmlSchemaSetParserStructuredErrors()... yes
creating Makefile
make
compiling html_document.c
gcc-4.7: error: unrecognized command line option '-Wshorten-64-to-32'
make: *** [html_document.o] Error 1
Gem files will remain installed in /usr/local/Cellar/ruby193/1.9.3-p448/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.0 for inspection.
Results logged to /usr/local/Cellar/ruby193/1.9.3-p448/lib/ruby/gems/1.9.1/gems/nokogiri-1.6.0/ext/nokogiri/gem_make.out
谁能帮我?
我在 1.6.1 中遇到了同样的错误。 我在OS X Mavericks上通过切换到llvm-gcc
解决了这个问题。
CC=llvm-gcc gem install nokogiri -v '1.6.1'