Mac user and getting WARNING: Nokogiri was built against LibXML version 2.7.8, but has dynamically loaded 2.7.3

Binary Logic picture Binary Logic · Jul 23, 2011 · Viewed 36.4k times · Source

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.

After upgrading to Lion I am getting segmentation faults in Ruby. I'm fairly confident it's Nokogiri. So I installed libxml2 via Homebrew. I ran brew link libxml2. Then I reinstalled Nokogiri using that version of the library.

For proof:

$ nokogiri -v
# Nokogiri (1.5.0)
---
warnings: []
nokogiri: 1.5.0
ruby:
  version: 1.9.2
  platform: x86_64-darwin11.0.0
  description: ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.0.0]
  engine: ruby
libxml:
  binding: extension
  compiled: 2.7.8
  loaded: 2.7.8

I've already included Nokogiri at the top of my gemfile and I've also required it in my environment file. I have no idea why I am still getting that warning.

Any suggestions or ideas to make sure it's loading the right version libxml2?

Answer

indirect picture indirect · Feb 2, 2013

If you installed Nokogiri with gem install nokogiri, you can resolve this warning by running gem pristine nokogiri to recompile the gem's C extension.

If you installed Nokogiri with bundle install, you can resolve this warning by running bundle exec gem pristine nokogiri to recompile the C extension of the gem wherever Bundler installed it.