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
Passing flags to install gems is generally a bad idea if you've got a Gemfile and are using bundler. Even if you're not, you'll be on a custom-compiled libxml and you probably won't remember...! I started by hacking around trying to get this to work and even brew installing libxml2.
Turns out, if you reinstall (and therefore recompile) the ruby version you're working with (hopefully with rvm), it'll work.
So, for RVM users:
rvm list (gets your rubies - choose the one being used)
rvm uninstall RUBY_VERSION
rvm install SAME_RUBY_VERSION
bundle (or gem install nokogiri)
It did the trick for me.