Last Updated: February 25, 2016
· gabebw

Fix those Nokogiri libxml version mismatch errors

I see these errors a lot:

WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.8.0

Here's how to fix them:

# Mercilessly nuke every Nokogiri version
$ gem uninstall nokogiri --all --force --executables 
# These arguments will be passed to `gem install nokogiri`
$ bundle config build.nokogiri -- --with-xml2-include=`brew --prefix libxml2`/include/libxml2 --with-xml2-lib=`brew --prefix libxml2`/lib --with-xslt-dir=`brew --prefix libxslt`
# Reinstall
$ bundle install

You'll need to do this every time you install a new version of libxml.

4 Responses
Add your response

this is great :)

over 1 year ago ·

Thank you Gabe

over 1 year ago ·


over 1 year ago ·

I've put together a ruby script as a gist which does something similar.

over 1 year ago ·