4

I'm trying to install the nokogiri gem on mavericks and getting the error:

checking for xmlParseDoc() in -lxml2... no
-----
libxml2 is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

Libxml2 is installed via homebrew. I've installed xcode as suggested on other stackoverflow questions, but the issue still remains.

benc
  • 1,978
  • 3
  • 15
  • 22
  • Possible duplicate [http://stackoverflow.com/questions/9134423/os-x-lion-attempting-nokogiri-install-libxml2-is-missing](http://stackoverflow.com/questions/9134423/os-x-lion-attempting-nokogiri-install-libxml2-is-missing) – ole May 05 '14 at 22:57
  • I am having the same issue. After working for 8 hours, I wiped my Mac clean and started over and got the same result. What did you do to resolve this? – jhamm Sep 05 '14 at 13:03
  • I moved on, however it looks like this guy resolved something similar https://github.com/sparklemotion/nokogiri/issues/1091 – benc Sep 09 '14 at 10:23

1 Answers1

2

I had to be explicit about it's location, as well as for iconv. It was a few weeks ago but I seem to remember it being like this:

gem install nokogiri -- --with-xml2-lib=[path on your system] --with-xml2-include=[path on your system] --with-iconv-dir=[path on your system]

These for me (OSX 10.9) are:

gem install nokogiri -- --with-xml2-lib=/opt/local/lib --with-xml2-include=/opt/local/include/libxml2 --with-iconv-dir=/usr/local
user1821510
  • 665
  • 5
  • 6
  • 5
    In order to get this to work for me (10.10) I also needed to include the use-system- libraries option `gem install nokogiri -- --use-system-libraries --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local` – Neil Neyman Mar 26 '15 at 17:18
  • That worked for me though on my system (OpenSUSE) the option is ```--with-xml2lib``` (not hyphenated). I've had Nokogiri/libxml problems on all my Mac and Linux systems. – idoimaging Apr 29 '15 at 20:16