How to Install Nokogiri on MAC Os Sierra 10.12

How to install Nokogiri on Mac OS Sierra 10.12

Open Xcode and, from the menu XCode -> Preferences update your Command Line Tools (Xcode 8.0).

Then do:

bundle config build.nokogiri --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2
bundle install

or just:

gem install nokogiri -v 1.6.8.1 -- --use-system-libraries=true --with-xml2-include="$(xcrun --show-sdk-path)"/usr/include/libxml2

nokogiri gem installation error

Finally, the problem was caused by nokogiri itself by shipping it's own libxml2 that's incompatible with some systems.

So to install nokogiri I had to tell it that it should use the system libraries.

I installed it manually by:

gem install nokogiri -v 1.6.2.1 -- --use-system-libraries

And it worked well. Other answers didn't solve it.

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.

Nokogiri 'Failed to build gem native extension' when I run bundle install

Previous advises didn't help me, here is the solution for OS 10.9:

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


Related Topics



Leave a reply



Submit