0

gem install nokogiri fails with libxml2 is missing.

Details of the message show:

checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no

This is in spite of the fact that I've confirmed the installation of libxml2.

All efforts at passing the library's location using the command line flag have failed.

I'm running:

  • Ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
  • Mac Yosemite
  • Installed with homebrew
StormyKnight
  • 509
  • 3
  • 13

2 Answers2

0
  1. Move to /usr/local/Cellar/libxml2/2.9.2/lib.
  2. Run the file called xml2Conf.sh.
  3. Run gem install nokogiri -- --use-system-libraries.
StormyKnight
  • 509
  • 3
  • 13
0

Have you tried the Nokogiri Mac OS installation notes?

“I’m on a fresh Yosemite installation.”

Team Nokogiri has reproduced an issue with brand-spanking-new Yosemite installations, which can be corrected by running:

gem update --system

There's also "Nokogiri installation fails -libxml2 is missing" and "Install Nokogiri on Yosemite 10.10.3".

Community
  • 1
  • 1
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • That's in my history, so apparently I tried it at some point. I don't remember what the output from it said. – StormyKnight Oct 02 '15 at 03:19
  • Often your best/fastest path to an answer of this sort, is to take it to the IRC channel associated with that particular piece of code. The people who specialize in that particular subject tend to hang out there. From the documentation: `The IRC channel is #nokogiri on freenode.` IRC works well because, similar to chat here, it allows questions and answers, however on IRC it's obvious the subject is Nokogiri. – the Tin Man Oct 02 '15 at 16:49