After making a fresh install of Mac OS X 10.8 Mountain Lion, and after installing Ruby 1.9.3 and Ruby on Rails 3.2.6, I started the Rails console and I got this warning message:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
How can I fix it?
I reinstalled Ruby, that fixed it. Was able to use the built-in libraries.
Even Better:
Note:
This will happen repeatedly as you upgrade your system and libraries change.
Note that linking as in @Davids post will interfere with your build tools and link into your OS (which is most likely not what you want if you're using brew), but you can just execute each command above except omit the 'brew link' lines and everything will still build just fine, eg:
Based on the answer from @David the following steps were enough for me. No compiler flags and custom paths.
I have found some fixes for Lion, but none for Mountain Lion yet. Nonetheless I have tried this and it works:
Source (for Lion): https://gist.github.com/1349681
Putting
gem 'nokogiri'
abovegem '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.