Making Bundler 0.8.5 install Nokogiri on Leopard with a newish libxml

Nokogiri on a standard installation of Leopard is complain-y about a couple of old libraries:

“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.”

Aaron Kalin figured out how to fix this if you’re installing nokogiri as a system gem, but I want to use Bundler and keep my system gems down to the bare minimum. I figured out how to do this under Bundler 0.8.5.

The gems I have installed via plain old “gem install xxx” are bundler08 -v0.8.5, rake -v0.8.7, and ZenTest -v4.2.1. That’s it. Everything else is under vendor/bundler. I’m using RVM and REE 1.8.7 2009.10 as described in my previous post.

Here is a quick summary of Aaron’s blog post; this will update your libxml and libxslt libraries to reasonably recent versions. (Be my guest if you want to use libxml 2.7.7 and libxslt 1.1.26, which are current as of today, but I didn’t test those myself.)

Now make this YAML file and call it bundler_build_options_macosx_leopard.yml and put it in your RAILS_ROOT:

Then, to build nokogiri so that it uses the new libs you just installed:

You should now have nokogiri installed under vendor/bundler/ruby/1.8/gems, and when you run your app it should not complain about the version of libxml2 anymore.

Update: Bundler 1.0.0.beta.10 allows this too. See my other post that shows how to do it.

1 thought on “Making Bundler 0.8.5 install Nokogiri on Leopard with a newish libxml”

  1. Thanks so much for this—just what I needed. I’m truly fortunate that Google indexes so quickly, seeing as you just posted this yesterday.

Leave a Reply

Your email address will not be published. Required fields are marked *