Mountain Lion - LibXML & Nokogiri
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.
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
I have found some fixes for Lion, but none for Mountain Lion yet. Nonetheless I have tried this and it works:
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
brew install libxml2 --with-xml2-config
brew link libxml2
brew install libxslt
brew link libxslt
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.8.0/include/libxml2/ --with-xml2-lib=/usr/local/Cellar/libxml2/2.8.0/lib/ --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26/
Source (for Lion): https://gist.github.com/1349681
troubles with nokogiri gem on mountain lion using bundler
You shouldn't be using sudo
if you're using RVM or similar Ruby versions manager.
WARNING: Nokogiri was built against LibXML version 2.8.0, but has dynamically loaded 2.9.1
I also was getting this error frequently on OS X 10.9.1. This answer did the trick for me: https://stackoverflow.com/a/14658949/1769539
Or, to save you the trip - here's what worked for me, specifically:
"If you installed Nokogiri with bundle install, you can resolve this warning by running bundle exec gem pristine nokogiri
and then 'bundle install'"
WARNING: Nokogiri was built against LibXML version 2.7.7, but has dynamically loaded 2.6.16
In the end I had to install the gem against the specific versions of xml2
and xslt
I have installed:
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.7/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.7/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26
#. scrollbar line, so the code can be seen
The problem was most likely bad library management, switching between package managers without being tidy enough about it.
Related Topics
Ruby - Elegantly Convert Variable to an Array If Not an Array Already
Return Two and More Values from a Method
How to Handle Constants in Ruby When Using Rails
What's the Difference Between Request.Remote_Ip and Request.Ip in Rails
How to List the Currently Available Objects in the Current Scope in Ruby
Failed to Build Gem Native Extension When Install Redcloth-4.2.9 Install Linux
When to Use Struct Instead of Hash in Ruby
Installing Ruby 1.9.1 on Ubuntu
Ruby: Is There an Opposite of Include? for Ruby Arrays
When We Import CSV Data, How Eliminate "Invalid Byte Sequence in Utf-8"
Raise Custom Exception with Arguments
Break and Return in Ruby, How to Use Them
Installed Rails But the Rails Command Says It's Not Installed
Is There a Way in Ruby/Rails to Execute Code That Is in a String
Ruby: How to Load a File into Interactive Ruby Console (Irb)