I\'m getting this error when trying to run rspec in Hartl\'s tutorial. I googled the error, but it\'s never for the specific version and the fixes don\'t actually fix my pro
First, check your version of libxml:
otool -L /usr/lib/libxml2.2.dylib
It can return
/usr/local/opt/libxml2/lib/libxml2.2.dylib (compatibility version 11.0.0, current version 11.0.0)
or
/usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.9.0)
Then you can try reinstalling libxml to upgrade it:
brew uninstall libxml2 libxslt
brew install libxml2 libxslt
After that, try to recompile your package:
make clean
./configure
make
sudo make install
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.
Try the following inside your project directory.
gem uninstall nokogiri
If there are more than one versions installed, a prompt will appear asking which version to remove. use the last option that reads "All versions".
Next, run bundle install
inside your project directory. once it finishes installing the needed gems you should be good to go.
In my case, I hit the last option "All versions" as it doesn't hurt my project but it is possible that you might need the other versions based on different projects.
Not sure if it helps anyone, but I could just get nokogiri installed by using system libs
gem install nokogiri -- --use-system-libraries
Reinstalling the gem didn't work for me, nor did pulling the particular branch.
It's not ideal, but I found that rolling back to 1.5.9 solved the issue.
Your error message says:
nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0
This makes me think that your gem actually requires a version of libxml that is newer than your system version. How have you installed libxml2? If you have homebrew installed, you might want to try upgrading it with
brew update
brew upgrade
I was able to install Nokogiri 1.6.0 with Ruby 2.0.0p247 on OS X 10.9, and then require it in IRb. I double checked with Homebrew, and it is actually keg-only. However, Nokogiri seems to install its own version into gems/nokogiri-1.6.0/ports
. On my machine, it is under x86_64-apple-darwin13.0.0.