1

I'm the most horrible of horrible installs of nokogiri.

I've used homebrew to install its libxml2 and libxslt dependencies. I've linked them using brew link. I've unlinked and linked back again. I've got brew 0.8.1.

I've been on the nokogiri installation webpage and passed in the builds and still can't get it to install.

I keep getting

libxml2 is missing.

Please help. Would an install on MacPorts be the next plan of attack?

Mark Thomas
  • 37,131
  • 11
  • 74
  • 101

4 Answers4

1

I solved it updating zlib1g from 1.2.3 to 1.2.7:

$> aptitude update
$> aptitude install zlib1g
robermorales
  • 3,293
  • 2
  • 27
  • 36
1

You need to upgrade your homebrew to 0.9

then follow these steps

brew install libxml2 libxslt
brew link libxml2 libxslt
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

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

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

You should double check the folder library version.

Ilake Chang
  • 1,542
  • 1
  • 14
  • 19
0

As suggested from the console output

gem install nokogiri -- --use-system-libraries [--with-xml2-config=/path/to/xml2-config] [--with-xslt-config=/path/to/xslt-config]

and a couple of find commands: find /usr/local -name xml2-config find /usr/local -name xslt-config

The following worked for me:

sudo gem install nokogiri -- --use-system-libraries --with-xml2-config=/usr/local/Cellar/libxml2/2.9.2/bin/xml2-config --with-xslt-config=/usr/local/Cellar/libxslt/1.1.28_1/bin/xslt-config

AixNPanes
  • 1,170
  • 3
  • 14
  • 33
0

libxml2 via MacPorts has always worked for me. port install libxml2 libxslt

see also OS X Lion, Attempting Nokogiri install - libxml2 is missing and http://nokogiri.org/tutorials/installing_nokogiri.html

Community
  • 1
  • 1
John Douthat
  • 40,711
  • 10
  • 69
  • 66