gem安装nokogiri -v '1.6.3.1' on OS X 10.10 Yosemite不安装。

时间:2023-01-05 00:15:07

After update to OS X 10.10 Yosemite I can't install nokogiri (1.6.3.1)

更新到OS X 10.10 Yosemite后,我无法安装nokogiri (1.6.3.1)

> bundle

Building nokogiri using packaged libraries.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/ju/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv 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=/Users/ju/.rvm/rubies/ruby-2.1.2/bin/ruby
    --help
    --clean
    --use-system-libraries
    --enable-static
    --disable-static
    --with-zlib-dir
    --without-zlib-dir
    --with-zlib-include
    --without-zlib-include=${zlib-dir}/include
    --with-zlib-lib
    --without-zlib-lib=${zlib-dir}/lib
    --enable-cross-build
    --disable-cross-build

extconf failed, exit code 1

Gem files will remain installed in /Users/ju/.rvm/gems/ruby-2.1.2@sumup/gems/nokogiri-1.6.3.1 for inspection.
Results logged to /Users/ju/.rvm/gems/ruby-2.1.2@sumup/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.3.1/gem_make.out
An error occurred while installing nokogiri (1.6.3.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.3.1'` succeeds before bundling.

3 个解决方案

#1


8  

> brew update
> brew install libxml2 libxslt libiconv

> brew --prefix libxml2
/usr/local/opt/libxml2

> brew --prefix libxslt
/usr/local/opt/libxslt

> brew --prefix libiconv
/usr/local/opt/libiconv

> gem uninstall nokogiri

> gem install nokogiri -v 1.6.3.1 -- --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config

Based on: Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks

基于:Mac fix 1 -在Mac OS 10.9 Mavericks上安装Nokogiri gem。

Other solution:

其他解决方案:

> gem install nokogiri -v 1.6.3.1 -- --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2/

Another solution from comments:

另一个解决方案的评论:

> xcode-select --install gem install nokogiri

#2


4  

The following worked for me on Yosemite 10.10.3:

以下为我在Yosemite 10.10.3:

sudo gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2 --use-system-libraries

It was taken from the Nokogiri issues tracker.

它是由Nokogiri问题追踪器拍摄的。

#3


0  

brew update brew install libxml2 libxslt libiconv

brew update brew安装libxml2 libxslt libiconv。

brew --prefix libxml2 /usr/local/opt/libxml2

啤酒——prefix libxml2 /usr/local/opt/libxml2

brew --prefix libxslt /usr/local/opt/libxslt

啤酒——prefix libxslt /usr/local/opt/libxslt

brew --prefix libiconv /usr/local/opt/libiconv

啤酒——prefix libiconv /usr/local/opt/libiconv

gem uninstall nokogiri

宝石卸载nokogiri

gem install nokogiri -v 1.6.3.1 -- --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config

gem安装nokogiri -v 1.6.3.1——使用-xslt-dir=/usr/local/opt/libxslt -with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config——with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config。

#1


8  

> brew update
> brew install libxml2 libxslt libiconv

> brew --prefix libxml2
/usr/local/opt/libxml2

> brew --prefix libxslt
/usr/local/opt/libxslt

> brew --prefix libiconv
/usr/local/opt/libiconv

> gem uninstall nokogiri

> gem install nokogiri -v 1.6.3.1 -- --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config

Based on: Mac fix 1 - Install the Nokogiri gem on Mac OS 10.9 Mavericks

基于:Mac fix 1 -在Mac OS 10.9 Mavericks上安装Nokogiri gem。

Other solution:

其他解决方案:

> gem install nokogiri -v 1.6.3.1 -- --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2/

Another solution from comments:

另一个解决方案的评论:

> xcode-select --install gem install nokogiri

#2


4  

The following worked for me on Yosemite 10.10.3:

以下为我在Yosemite 10.10.3:

sudo gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2 --use-system-libraries

It was taken from the Nokogiri issues tracker.

它是由Nokogiri问题追踪器拍摄的。

#3


0  

brew update brew install libxml2 libxslt libiconv

brew update brew安装libxml2 libxslt libiconv。

brew --prefix libxml2 /usr/local/opt/libxml2

啤酒——prefix libxml2 /usr/local/opt/libxml2

brew --prefix libxslt /usr/local/opt/libxslt

啤酒——prefix libxslt /usr/local/opt/libxslt

brew --prefix libiconv /usr/local/opt/libiconv

啤酒——prefix libiconv /usr/local/opt/libiconv

gem uninstall nokogiri

宝石卸载nokogiri

gem install nokogiri -v 1.6.3.1 -- --with-xslt-dir=/usr/local/opt/libxslt --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config

gem安装nokogiri -v 1.6.3.1——使用-xslt-dir=/usr/local/opt/libxslt -with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config——with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config。