Skip to content

Instantly share code, notes, and snippets.

@softprops
Forked from fabioyamate/nokogiri
Created December 18, 2010 23:30
Show Gist options
  • Save softprops/746966 to your computer and use it in GitHub Desktop.
Save softprops/746966 to your computer and use it in GitHub Desktop.
# using rvm with ruby-1.8.7-p249
# latest version 2.7.7 2010-06-17
brew install libxml2
# installing libxslt from source code
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
tar xvfz libxslt-1.1.26.tar.gz
cd libxslt-1.1.26
./configure --prefix=/usr/local/Cellar/libxslt/1.1.26 --with-libxml-prefix=/usr/local/Cellar/libxml2/2.7.7
make
sudo make install
# installing nokogiri with this new compiled libs
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.7/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.7/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
@arojoal
Copy link

arojoal commented Jul 9, 2014

same problem for me.

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/rojalval/.rvm/rubies/ruby-2.0.0-p481/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/rojalval/.rvm/rubies/ruby-2.0.0-p481/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

@arojoal
Copy link

arojoal commented Jul 9, 2014

I've solved it by installing XCode ComandLine tools:

xcode-select --install

Copy link

ghost commented Aug 12, 2014

@arojoal
Thanks for:
xcode-select --install

It solved the problem for me too

@SteveBenner
Copy link

As a self-contained solution, I wrote a Ruby script that just installs Nokogiri using Homebrew's libraries instead of Apple's. It seems to flawlessly solve the issue on normal systems; I've used it twice without any issues. You can choose whether to install using either RubyGems or Bundler. Contributions or suggestions are welcome!

@ananth99
Copy link

I can confirm xcode-select --install worked for me. Thanks @arojoal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment