I\'ve just updated to OS X Mountain Lion and I\'m getting the following when working with rails and terminal.
WARNING: Nokogiri was built against LibXML vers
Putting gem 'nokogiri'
above gem 'pg'
in my Gemfile fixed this for me.
My Gemfile didn't have nokogiri in it, but it was a dependency that was in Gemfile.lock, so I put it in my Gemfile explicitly.
Nothing seemed to work for me to fix this one.
Then I went into xcode and installed the updated command line tools, then gem uninstall nokogiri
and gem install nokogiri
and it worked!
Using Ruby 1.9.3-p194 and Rails 3.2.11 on OS X 10.8.2 (Mountain Lion), starting rails c gave the warning:
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.7.8
The uninstall/install nokogiri trick didn't work for me. The solution was much simpler... The warning was avoided completely by editing the Gemifile to place 'nokogiri' above 'pg'.
References:
After upgrading ruby-build
brew update
brew upgrade ruby-build
I just reinstalled ruby (last version)
rbenv install 1.9.3-p194
and then I installed all the gems related to my project including nokogiri without having further problems.
gem install bundler
bundle
So I ended up using the following command:
bundle config build.nokogiri --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
And then doing:
gem uninstall nokogiri
gem install nokogiri
And then ran
bundle install
all the solution listed so far in here didn't work for me.
So, I did a brew uninstall libxml2
it was the version libxml2 2.8.0
and i guess my os x has libxml2 version 2.7.8 pre-installed
then i did gem uninstall nokogiri
and then gem install nokogiri
Warning is gone now. But it's libxml2 version 2.7.8 and not the latest. So, I appreciate, if you suggest some solution that work with latest version of libxml2.