2

I'm trying to run a Ruby script, so I installed Ruby together with Ruby gems on my Mac OS X 10.7 system. The script requires the Rubygem "mechanize" so I tried to install it by using:

sudo gem install mechanize

However this fails with an error:

Error installing mechanize: ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb checking for libxml/parser.h... no ----- libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.

So it seems libxml2 is missing or not found. What is the easiest way to install it? It's already in /usr/lib:

/usr/lib/libxml2.2.7.3.dylib 
/usr/lib/libxml2.dylib 
/usr/lib/libxml2.2.dylib

I have to add that I don't know anything about Ruby programming, I just want to run a little script I found at github.

slhck
  • 235,242
asdrubael
  • 707

1 Answers1

1

I installed Xcode and re-build libxml2 and libxslt manually like described here tar xzvf libxml2-2.7.3.tar.gz cd libxml2-2.7.3 ./configure --with-python=/System/Library/Frameworks/Python.framework/Versions/2.3/ make sudo make install

cd /usr/local/src
curl -O ftp://xmlsoft.org/libxslt/libxslt-1.1.20.tar.gz
cd libxslt-1.1.20
./configure
make
sudo make install 
soandos
  • 24,600
  • 29
  • 105
  • 136
asdrubael
  • 707