I know there are a lot of questions about this gem but no answer has worked for me.
When I run in SSH gem install nokogiri
I get this error:
<
Just Like wongzigii says the install command works with those flags with macOS Sierra
gem install nokogiri -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include/libxml2/
I ran into this same problem, because of an unlisted build dependency. When I found the tmp directory in question:
find ~/.rbenv/ -name patch.log
It said:
sh: patch: command not found
Fixed that with a simple:
sudo yum install -y patch
Am using macOS Sierra.
Went to nokogiri documentation and followed this:
ON MAC OSX
Installation should Just Work™ using Nokogiri’s vendored libxml2 and libxslt.
First, make sure you have the latest version of RubyGems and xcode commandline tools:
1 gem update --system
2 xcode-select --install
Then install nokogiri:
1 gem install nokogiri
Nothing in current answers worked for me (I use Ubuntu 16.04, not Mac).
However, by following the instructions in Nokogiri site and this part did the trick:
# See http://www.nokogiri.org/tutorials/installing_nokogiri.html#ubuntu___debian
sudo apt-get install build-essential patch
sudo apt-get install ruby-dev zlib1g-dev liblzma-dev
Note I've been using Nokogiri since 2009 and I've always had trouble installing it. Any further comment would probably not comply with SO T&Cs :)
step 1:
brew install libxml2
Step 2:
bundle config build.nokogiri --use-system-libraries
Step 3: then try
bundle install