Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failure to install nokogiri libiconv is missing on Yosemite Mac OS X 10.10

Trying to install Nokogiri I’m getting the following error

Maxims-MacBook-Air:ScrapingTheApple maximveksler$ gem install nokogiri
Fetching: nokogiri-1.6.2.1.gem (100%)
Building native extensions.  This could take a while...
Building nokogiri using packaged libraries.
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    /Users/maximveksler/.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/maximveksler/.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/maximveksler/.rvm/gems/ruby-2.1.2/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/maximveksler/.rvm/gems/ruby-2.1.2/extensions/x86_64-darwin-13/2.1.0-static/nokogiri-1.6.2.1/gem_make.out
like image 950
Maxim Veksler Avatar asked Jul 12 '14 09:07

Maxim Veksler


4 Answers

I suggest an update to Oskar's answer, replace MacOSX10.9.sdk to MacOSX10.10.sdk, tested on OS X 10.10

gem install nokogiri -- \
--with-iconv-lib=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib \
--with-iconv-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include
like image 39
ryaneof Avatar answered Nov 10 '22 11:11

ryaneof


The nokogiri install tutorial provides the solution:

# bash
brew unlink gcc
gem uninstall nokogiri
xcode-select --install
gem install nokogiri

If you don't have Xcode 6.1, yet, you may install it from the apple developer download site (section additional tools), as described in this blog post.

like image 154
fiedl Avatar answered Nov 10 '22 11:11

fiedl


I was successfull with:

gem install nokogiri -- \
--with-iconv-lib=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/lib \
--with-iconv-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include
like image 8
Oskar Gargas Avatar answered Nov 10 '22 11:11

Oskar Gargas


without brew and other stuff:

xcode-select --install 
gem install nokogiri -- --use-system-libraries
like image 6
Valery Kvon Avatar answered Nov 10 '22 12:11

Valery Kvon