Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib

I suggest you first uninstall Nokogiri using:

sudo gem uninstall nokogiri

Then install Nokogiri using rubygems:

gem install nokogiri

If that doesn't work, there's an open issue on Nokogiri to support libxml 2.9.0 and later. There's a libxml2-2.9.1 branch that was started in preparation for the next release of libxml2.

Then try pulling from that branch in your Gemfile like this:

gem "nokogiri", github: "sparklemotion/nokogiri", branch: "libxml2-2.9.1"

or install an older version of libxml2.

If that still doesn't work you may also want to try the suggestions here: What to do if libxml2 is being a jerk.


Not sure if it helps anyone, but I could just get nokogiri installed by using system libs

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

If you have Homebrew installed, try this. It solves the issue with the "Parsing documentation for nokogiri-1.6.1" hang. This worked for me.

gem uninstall nokogiri libxml-ruby

It'll ask you a series of questions based on how much of it you want to uninstall, answer "yes" or "[y]" to all.

brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link --force libxml2
brew install libxslt 
brew link --force libxslt 

gem install nokogiri --no-rdoc --no-ri 

Then, in your project file:

bundle install