I have done all kinds of research and tried many different things. I know this question has been answered many times, but none of the suggested solutions are working for me.
gem install libxml-ruby helps me
None of this worked for me.
I had libxml2 installed at a later version (2.7.8) with brew. This caused nokogiri to compile against it and the later problems. Solution, remove it, then build, then install if desired.
Here's what worked:
brew uninstall libxml2
(if previously installed)gem uninstall nokogiri
gem install nokogiri
brew install libxml2
(optional)Bundler has options to set the default build locations. So for instance, with libxml2 installed via macports:
$ bundle config build.nokogiri --with-xml2-include=/opt/local/include/libxml2 --with-xml2-lib=/opt/local/lib --with-xslt-dir=/opt/local
After doing this and bundle install
, the warning went away.
There's also some helpful examples for setting build options on the nokogiri wiki.
If you have this message and your nokogiri is out-of-date with the version available from the gem source, simply run bundle update nokogiri
to get the new code and recompile. Your error should go away.