Skip to content
Matthias Hecker edited this page Mar 10, 2015 · 1 revision

Error installing mechanize: libxml2 is missing

checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
-----
libxml2 is missing.  Please locate mkmf.log to investigate how it is failing.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Mechanize requires nokogiri which is a XML/HTML parsing library, that requires to building a native extension. This sometimes fails if buildtools or required headers are missing. The most recent versions of nokogiri should already ship with the required libraries but in case this fails install libxml2 and libxslt. Debian users can install those dependencies with sudo apt-get install libxml2-dev libxslt1-dev zlib1g-dev libbz2-dev and install it with sudo gem install mechanize.

In case this does not fixes the problem, try:

gem install nokogiri -- --use-system-libraries
gem install mechanize

Clone this wiki locally