Error while installing Nokogiri (1.6.7) on El Capitan
Solution 1:
You should install xcode-select
packages first, then try installing nokogiri again. Try these commands,
xcode-select --install
then try
gem install nokogiri
with whatever Nokogiri version you want.
Nokogiri depends on multiple libraries like libxslt, libxml and zlib. Dev versions (including source) of these should be installed before installing Nokogiri in any Linux distribution. For OS X, the above command should work I guess.
The actual solution is in the comments below.
Solution 2:
Try this :
gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/
And then run
bundle update
I hope this could help you :)
Solution 3:
I you're using homebrew to maintain libraries like libml on your mac, the following command on your mac might help:
gem install nokogiri -v '1.6.8' -- --use-system-libraries --with-xml2-include=/usr/local/Cellar/libxml2/2.9.2/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.2/lib/
just ensure that the path for libxml is same as mine unless brew changes with the next version. You can check this by running the below command:
brew info libxml2
Solution 4:
Edit Updated work good with MacOS Sierra :
xcode-select --install
Add gem "nokogiri", ">= 1.6.7.rc3"
in your Gemfile
and then run
bundle install
Solution 5:
try to:
apt-get install ruby-nokogiri
bundle install