Reputation: 17461
After update to OS X 10.10 Yosemite I can't install 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.
Upvotes: 2
Views: 2678
Reputation: 1407
In case you are using bundle install --path vendor/bundle
to install gems into local folder and get error
Building nokogiri using packaged libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
Then, you need to do following to use
bundle config build.nokogiri --use-system-libraries
bundle install --path vendor/bundle
Then install will pass with
Fetching nokogiri 1.6.3.1
Installing nokogiri 1.6.3.1 with native extensions
Building nokogiri using system libraries.
Upvotes: 0
Reputation: 602
The following worked for me on 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.
Upvotes: 4
Reputation: 17461
> 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
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
Upvotes: 8
Reputation: 11
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
Upvotes: 1