8

I have hit upon a stumbling block here trying to get Nokogiri working on osx 10.5.8.

Tried http://nokogiri.org/tutorials/installing_nokogiri.html and then http://martinisoftware.com/2009/07/31/nokogiri-on-leopard.html

A colleague has been trying to help too but cannot get rid of this error message:

Library not loaded: /usr/local/lib/libxml2.2.dylib ... Reason: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0

We have tried to compile the gem using the newly installed libraries but still coming up against this error.

Any help or pointers really appreciated!

I have been given a copy of osx 10.6 - could this help??

Thanks

Adamski
  • 3,585
  • 5
  • 42
  • 78
  • I'd definitely try with an upgrade to 10.6 - many installs take this for granted and the docs often don't warn you... I've successfully solved a few similar lib problems under 10.5, but it's usually a painful operation. – Dave Everitt Jul 02 '12 at 17:57
  • Thanks - do you mean a full clean install, or just an upgrade? – Adamski Jul 02 '12 at 21:44
  • I'd do a clean 10.6 install and rebuild your environment. It will also ease the transition to 64 bit libraries, since with some installs there's a bit of a developer cutoff between Leopard and Snow Leopard. – Dave Everitt Jul 02 '12 at 22:07

3 Answers3

20

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

brew install libxml2 libxslt
brew link libxml2 libxslt

Then install libiconv from source:

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
tar xvfz libiconv-1.13.1.tar.gz
cd libiconv-1.13.1
./configure --prefix=/usr/local/Cellar/libiconv/1.13.1
make
sudo 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!

Eric Lubow
  • 763
  • 2
  • 12
  • 30
Fer Martin
  • 1,541
  • 1
  • 13
  • 13
8

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

brew install libxml2 libxslt
gem install nokogiri -- --with-xslt-dir=/usr/local/opt/libsxlt
iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
Magnus
  • 411
  • 5
  • 4
0

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 libxslt
brew install libiconv
sudo 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...

Community
  • 1
  • 1
Dave Everitt
  • 17,193
  • 6
  • 67
  • 97
  • Thanks however I tried that and I still get the error message. We tried a few ways to tell it to use the newly installed packages but somehow nothing has worked so far.. – Adamski Jul 02 '12 at 21:43
  • 1
    Thanks again... still have this problem... I will upgrade, however I need to get things working asap and doing a clean install (in my case) is a full days work, which I am not sure my client will be happy to pay for.. – Adamski Jul 03 '12 at 08:31
  • BTW which version of Ruby are you using? – Dave Everitt Jul 03 '12 at 13:31