gem install nokogiri -v '1.6.8.1' fails gem install nokogiri -v '1.6.8.1' fails ruby-on-rails ruby-on-rails

gem install nokogiri -v '1.6.8.1' fails


I tried @the_basterd's recommendation. That didn't work, but the reference was good—thank you the_basterd. What worked from that reference was:

brew install libxml2

bundle config build.nokogiri --use-system-libraries --with-xml2-include=/usr/local/opt/libxml2/include/libxml2

Reference: https://github.com/sparklemotion/nokogiri/issues/1483

Later postings at that ref said that what I posted above "is strongly recommended against by the Nokogiri."

brew unlink xz; bundle install; brew link xz is preferred.


You can also encounter the same error message if you've downloaded XCode Tools but haven't yet agreed to the license.

From Terminal, run:

sudo xcodebuild -license

Enter your admin password, space through the agreement and type agree to accept. Run brew doctor and if necessary, brew update and you should be in good shape.