Install problems: Nokogiri on Mac OSx Mountain Lion - ruby

For some reason I cannot install Nokogiri on my MacBook for traveling.
This is short output from gem install nokogiri:
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin12/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 /Users/jseidel/.rvm/gems/ruby-1.9.3-p327#rails3213/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin12/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin12/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 /Users/jseidel/.rvm/gems/ruby-1.9.3-p327#rails3213/gems/nokogiri-1.6.0/ports/x86_64-apple-darwin12/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... yes
checking for xmlParseDoc() in -lxml2... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
However, I used MacPorts and it says that it's already installed:
port installed | grep lib
libxml #1.8.17_0 (active)
libxml2 #2.9.1_0 (active)
Is it getting confused because both libxml and libxml2 are installed? (Probably not.) Or is there something else going on?
I've followed the installation instructions for Nokigiri installation and that doesn't help.
Finally, I uninstalled ports libxml and libxml2 and now it fails attempting to use libiconv, having gotten past the previous XML issue it seems.

try it
sudo port upgrade outdated

Related

Libxml2 missing mac os x 10.10

Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/Kartik/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
*** 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.
i fiddled around with this for quite a while and the following worked for me..
1) install libxml2 with homebrew
brew install libxml2
2) install the gem via
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri:1.6.4.1 -- --use-system-libraries --with-xml=/usr/local/Cellar/libxml2/
For any who are still getting "libxml2 version 2.6.21 or later is required!" message, removing --use-system-libraries from hlv's step 2 above, worked for me.
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri:1.6.4.1 -- --with-xml=/usr/local/Cellar/libxml2/2.9.2/
I finally ended up with this version independent line:
sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri -n /usr/local/bin -- --with-xml=/usr/local/Cellar/libxml2/
This worked for me (assuming Xcode is installed):
gem install nokogiri -- --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.‌platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2 --use-system-libraries
Inspired by https://stackoverflow.com/a/28767045/1884907 (credits to lx00st)
(For MacOX 10.12.x) Perhaps you want to brew install libxml2 and also try linking into /usr/local/ first: brew link --force libxml2, then try that gem install nokogiri -- --use-system-libraries.
Using ports:
gem install nokogiri -- --use-system-libraries --with-xml=/opt/local/lib/libxml2.a
My solution, using ports:
sudo ARCHFLAGS='-arch x86_64' gem install nokogiri -- --use-system-libraries
By default, it will compile for x86_64 and i386, architecture for i386 should disabled, because the dependencies libraries in port only provide x86_64 version by default.
This is a bit of a rehash of all the other answers, but this worked for me:
gem install nokogiri -v '1.6.6.2' -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.16 --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2 --use-system-libraries

Vagrant plugin and nokogiri install issue

I am attempting to install the vagrant-windows plugin on Mac OSX 10.9.2. I however consistently receive the error that Bundler cannot install nokogiri 1.6.2.
Examining the gem_make.out file reveals that nokogiri cannot find libxml2, which I have installed and linked via homebrew.
Below is my gem_make.out
/Applications/Vagrant/embedded/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
checking for iconv.h... yes
checking for iconv_open() in iconv.h... no
checking for iconv_open() in -liconv... yes
Building libxml2-2.8.0 for nokogiri with the following patches applied:
- 0001-Fix-parser-local-buffers-size-problems.patch
- 0002-Fix-entities-local-buffers-size-problems.patch
- 0003-Fix-an-error-in-previous-commit.patch
- 0004-Fix-potential-out-of-bound-access.patch
- 0005-Detect-excessive-entities-expansion-upon-replacement.patch
- 0006-Do-not-fetch-external-parsed-entities.patch
- 0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch
- 0008-Improve-handling-of-xmlStopParser.patch
- 0009-Fix-a-couple-of-return-without-value.patch
- 0010-Keep-non-significant-blanks-node-in-HTML-parser.patch
- 0011-Do-not-fetch-external-parameter-entities.patch
************************************************************************
IMPORTANT! Nokogiri builds and uses a packaged version of libxml2.
If this is a concern for you and you want to use the system library
instead, abort this installation process and reinstall nokogiri as
follows:
gem install nokogiri -- --use-system-libraries
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
However, note that nokogiri does not necessarily support all versions
of libxml2.
For example, libxml2-2.9.0 and higher are currently known to be broken
and thus unsupported by nokogiri, due to compatibility problems and
XPath optimization bugs.
************************************************************************
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxml2/2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0001-Fix-parser-local-buffers-size-problems.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0002-Fix-entities-local-buffers-size-problems.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0003-Fix-an-error-in-previous-commit.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0004-Fix-potential-out-of-bound-access.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0005-Detect-excessive-entities-expansion-upon-replacement.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0006-Do-not-fetch-external-parsed-entities.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0007-Enforce-XML_PARSER_EOF-state-handling-through-the-pa.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0008-Improve-handling-of-xmlStopParser.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0009-Fix-a-couple-of-return-without-value.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0010-Keep-non-significant-blanks-node-in-HTML-parser.patch...
Running 'patch' for libxml2 2.8.0... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxml2/0011-Do-not-fetch-external-parameter-entities.patch...
Running 'patch' for 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 /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/x86_64-apple-darwin12.5.0/libxml2/2.8.0)...
Building libxslt-1.1.28 for nokogiri with the following patches applied:
- 0001-Adding-doc-update-related-to-1.1.28.patch
- 0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch
- 0003-Initialize-pseudo-random-number-generator-with-curre.patch
- 0004-EXSLT-function-str-replace-is-broken-as-is.patch
- 0006-Fix-str-padding-to-work-with-UTF-8-strings.patch
- 0007-Separate-function-for-predicate-matching-in-patterns.patch
- 0008-Fix-direct-pattern-matching.patch
- 0009-Fix-certain-patterns-with-predicates.patch
- 0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch
- 0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch
- 0014-Fix-for-bug-436589.patch
- 0015-Fix-mkdir-for-mingw.patch
************************************************************************
IMPORTANT! Nokogiri builds and uses a packaged version of libxslt.
If this is a concern for you and you want to use the system library
instead, abort this installation process and reinstall nokogiri as
follows:
gem install nokogiri -- --use-system-libraries
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
************************************************************************
Extracting libxslt-1.1.28.tar.gz into tmp/x86_64-apple-darwin12.5.0/ports/libxslt/1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0001-Adding-doc-update-related-to-1.1.28.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0002-Fix-a-couple-of-places-where-f-printf-parameters-wer.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0003-Initialize-pseudo-random-number-generator-with-curre.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0004-EXSLT-function-str-replace-is-broken-as-is.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0006-Fix-str-padding-to-work-with-UTF-8-strings.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0007-Separate-function-for-predicate-matching-in-patterns.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0008-Fix-direct-pattern-matching.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0009-Fix-certain-patterns-with-predicates.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0010-Fix-handling-of-UTF-8-strings-in-EXSLT-crypto-module.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0013-Memory-leak-in-xsltCompileIdKeyPattern-error-path.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0014-Fix-for-bug-436589.patch...
Running 'patch' for libxslt 1.1.28... OK
Running git apply with /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/patches/libxslt/0015-Fix-mkdir-for-mingw.patch...
Running 'patch' for libxslt 1.1.28... OK
Running 'configure' for libxslt 1.1.28... OK
Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/jason/.vagrant.d/gems/gems/nokogiri-1.6.2/ports/x86_64-apple-darwin12.5.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for linker flags for static linking... NONE
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 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
--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=/Applications/Vagrant/embedded/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
--with-xml2lib
--without-xml2lib
--with-libxml2lib
--without-libxml2lib
I found I needed to explicitly tell Nokogiri to use certain libraries. This wasn't obvious to me at first as Vagrant uses an embedded version of Ruby and not anything to do with what is installed via brew, or the OS itself.
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 vagrant plugin install vagrant-windows
EDIT: Also just saw this exact same answer from earlier today in terms of nokogiri based plugins with Vagrant and not just vagrant-windows: https://stackoverflow.com/a/23635023/2619
Following #flurdy's suggestion, upgrading to the latest Vagrant, 1.6.5 in my case, fixed this after days of trying everything the internet has to throw at this problem.
I was having the same issue but with the vagrant-aws plugin on Mavericks...
NOKOGIRI_USE_SYSTEM_LIBRARIES=1 vagrant plugin install vagrant-aws did the trick.

Gem install Fail on Shared VirtualBox Folder

There's a Windows Host and an Ubuntu guest using VirtualBox.
We can gem install just fine for individual gems on Ubuntu. When running
bundle install --path vendor
for an app that is on a shared folder in Ubuntu it fails with.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
/var/www/chef-playground/vendor/ruby/2.1.0/gems/mini_portile-0.5.2/lib/mini_portile.rb:226: warning: Insecure world writable dir /opt/chef/embedded/bin in PATH, mode 040777
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-linux-gnu/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 /var/www/chef-playground/vendor/ruby/2.1.0/gems/nokogiri-1.6.1/ports/x86_64-linux-gnu/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-linux-gnu/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 /var/www/chef-playground/vendor/ruby/2.1.0/gems/nokogiri-1.6.1/ports/x86_64-linux-gnu/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... 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
Text file busy # unlink_internal - ./siteconf20140313-27134-167s4eq.rb
Gem files will remain installed in /var/www/chef-playground/vendor/ruby/2.1.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /var/www/chef-playground/vendor/ruby/2.1.0/extensions/x86_64-linux/2.1.0/nokogiri-1.6.1/gem_make.out
An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling
The last line of your stack trace has the explanation.
An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling
I ran into the same error while using it on Fedora 20. There is a good explanation of how to overcome it at the nokogiri site.
I ran the following 2 commands and then the bundle install worked:
sudo yum install -y rubygem-nokogiri
sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
It might be because of this:
Text file busy # unlink_internal - ./siteconf20140313-27134-167s4eq.rb
This is apparently an existing problem with regards to sharedfolders, Virtualbox and Windows hosts. It seems they have been blaming Window's aggressive file handling.
https://github.com/mitchellh/vagrant/issues/2282
Ansible text file busy error
https://unix.stackexchange.com/questions/52951/gedit-wont-save-a-file-on-a-virtualbox-share-text-file-busy
You can try a workaround by installing the gems somewhere on guest machine instead of inside your sharedfolder i.e. install your gems in your home directory: bundle install --path ~/vendor. You might have to reconfigure your .bundle/config to make sure you're pointing at the correct directory.

Not able to install Nokogiri 1.6.0 on Mac (Mountain Lion)?

I am not able to install Nokogiri on my Mac running Mountain Lion.
I tried to install it using command:
gem install nokogiri -v '1.6.0'
I get this output:
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
Can anyone please help me?
I was getting the same error with 1.6.1. I solved this on OS X Mavericks by switching to llvm-gcc.
CC=llvm-gcc gem install nokogiri -v '1.6.1'

Issue installing the Nokogiri gem in Mac OS X 10.5.8

I'm trying to install the Nokogiri gem under an RVM managed Ruby 1.8.7 installation in OS X Leopard (10.5.8).
I'm getting the following error:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/Users/user/.rvm/rubies/ruby-1.8.7-p352/bin/ruby extconf.rb
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()... no
-----
The function 'xmlHasFeature' is missing from your installation of libxml2. Likely this means that your installed version of libxml2 is old enough that nokogiri will not work well. To get around this problem, please upgrade your installation of libxml2.
Please visit http://nokogiri.org/tutorials/installing_nokogiri.html for more help!
*** extconf.rb failed ***
I have the latest libxml2 installed via homebrew (brew install libxml2), so I don't know what else to try.
Update:
I tried the instructions from the Nokogiri website and I can't get the Nokogiri gem installation to recognize libxml2.
Per the instructions
I installed and linked libxml2 and libxslt via homebrew:
brew install libxml2 libxslt
brew link libxml2 libxslt
gem install nokogiri
The error message has changed, but the Nokogiri installation complains that libxml2 is missing:
...
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... no
-----
libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies
The installed libxml2 version is 2.7.8.
Update update:
I tried installing the iconv library from homebrew to see if I could solve the error checking for iconv_open() in iconv.h... no, so I ran the commands:
brew install libiconv
brew link libiconv
And after finishing the installation, I tried to install the nokogiri gem again, to get this error message, where the installer now complains that libiconv is missing
hecking 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... no
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
I'm clueless.
Per the directions at: http://nokogiri.org/tutorials/installing_nokogiri.html you needed to use:
brew install libxml2 libxslt
brew link libxml2 libxslt
then
gem install nokogiri
Did you use those or only brew install libxml2?
Make sure there is no Nokogiri version available:
use gem uninstall nokogiri
First install the command-line tool for Xcode. Refer to "How to use/install gcc on Mac OS X 10.8 / Xcode 4.4".
Then run the following commands:
brew install libxml2
gem install nokogiri
Now it works well, I tried it.
brew install libxml2 libxslt
gem install nokogiri -- \
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.x/lib \
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.xx \
--with-iconv-lib=/usr/lib \
--with-iconv-include=/usr/local/include

Resources