sudo gem install nokogiri
Do you have an old version of libxml2?
create a file called test.rb with the following contents: require 'rubygems' require 'nokogiri' Execute it: ruby test.rb
If you see the following:
“HI. You’re using libxml2 version 2.6.16 which is over 4 years old and has
plenty of bugs. We suggest that for maximum HTML/XML parsing pleasure, you
upgrade your version of libxml2 and re-install nokogiri. If you like using
libxml2 version 2.6.16, but don’t like this warning, please define the constant
I_KNOW_I_AM_USING_AN_OLD_AND_BUGGY_VERSION_OF_LIBXML2 before requring nokogiri.”
Then you may choose to upgrade it on your Mac OS 10.5.x:
I initially tried the following Installing a Newer libxml2 on Mac OS X 10.5 without any luck.
Upgrade libxml2 via MacPorts
I was able to successfully upgrade libxml2 by installing it via MacPorts by doing:
sudo port install libxml2 sudo gem uninstall nokogiri (you have to uninstall and install nokogiri again to get it to work) sudo gem install nokogiri ruby test.rb
After you execute test.rb again, you should not see the message complaining about having an older version of libxml2 installed!
Leave a Reply