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
Installed Memcached via Homebrew, How to Start and Stop Server
Variables in Ruby Method Names
Modern Tools for Ruby/Rails for Building an Achievement System
Possible to Access the Index in a Hash Each Loop
Listen Error: Unable to Monitor Directories for Changes
Jruby on Rails VS. Ruby on Rails, What's Difference
Count, Size, Length...Too Many Choices in Ruby
How to Add 'Each' Method to Ruby Object (Or Should I Extend Array)
Differencebetween Gsub and Sub Methods for Ruby Strings
How to Get Unique Elements in This Array
Rails 4 - Pundit - Create Policy
Rspec: How to Write Unit Test Case to Receive an Exception Which Is Getting Raised in Private Method