Running 'compile' for libxslt 1.1.28... OK
Running 'install' for libxslt 1.1.28... OK
Activating libxslt 1.1.28 (from /Users/Kartik/.rbenv/versions/2.1.3/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.4.1/ports/x86_64-apple-darwin14.0.0/libxslt/1.1.28)...
checking for main() in -llzma... yes
checking for xmlParseDoc() in libxml/parser.h... no
checking for xmlParseDoc() in -lxml2... no
checking for xmlParseDoc() in -llibxml2... no
libxml2 is missing. Please locate mkmf.log to investigate how it is failing.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
i fiddled around with this for quite a while and the following worked for me..
1) install libxml2 with homebrew
2) install the gem via
This worked for me (assuming Xcode is installed):
Inspired by https://stackoverflow.com/a/28767045/1884907 (credits to lx00st)
I finally ended up with this version independent line:
Using ports:
(For MacOX 10.12.x) Perhaps you want to
brew install libxml2
and also try linking into/usr/local/
first:brew link --force libxml2
, then try thatgem install nokogiri -- --use-system-libraries
.My solution, using ports:
sudo ARCHFLAGS='-arch x86_64' gem install nokogiri -- --use-system-libraries
By default, it will compile for x86_64 and i386, architecture for i386 should disabled, because the dependencies libraries in port only provide x86_64 version by default.