Nokogiri osx 10.5.8 libxml incompatible library version Nokogiri osx 10.5.8 libxml incompatible library version ruby-on-rails ruby-on-rails

Nokogiri osx 10.5.8 libxml incompatible library version


Actually, the answer is in: http://nokogiri.org/tutorials/installing_nokogiri.html

brew install libxml2 libxsltbrew link libxml2 libxslt

Then install libiconv from source:

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gztar xvfz libiconv-1.13.1.tar.gzcd libiconv-1.13.1./configure --prefix=/usr/local/Cellar/libiconv/1.13.1makesudo make install

Then (finally) install nokogiri:

gem install nokogiri --                    --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2                     --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib                     --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26                     --with-iconv-include=/usr/local/Cellar/libiconv/1.13.1/include                     --with-iconv-lib=/usr/local/Cellar/libiconv/1.13.1/lib

Making sure that you have the versions of libxml2 as you have them in /usr/local/Cellar/libxml (in my case it was 2.8.0).

Happy coding!


The following worked for me on OS-X 10.9.1 (Mavericks):

brew install libxml2 libxsltgem install nokogiri -- --with-xslt-dir=/usr/local/opt/libsxlt


I just hopped on my 10.5 machine and remembered getting a working version of Nokogiri there - so looked up the command history and here's a cut'n'paste of my exact commands, using Homebrew:

brew install libxml2 libxsltbrew install libiconvsudo gem install nokogiri -- --with-xslt-dir=/usr/local/homebrew/Cellar/libxslt/1.1.26

Although I'd still upgrade to 10.6.

Older answer:

This answer might help. After resisting OS X package managers, I gave in to Homebrew which helped me solve similar issues. This is for RVM (where I remember going through a similar process) but the key is to tell the nokogiri gem to use the new libxml2 install.

BTW (slightly off-topic but relevant if you're going to 10.6) OOI you can check your mac for a 64 bit EFI in Terminal:

ioreg -l -p IODeviceTree | grep firmware-abi

you should see (if 64 bit):

"firmware-abi" = <"EFI64">

although (as detailed in the replies to that article) this doesn't mean everything's plain sailing...