Last Updated: February 25, 2016
·
1.789K
· mhenrixon

gem install nokogiri fails on Mac OS X....

We all know what to do by now

brew install libxml2 libxslt libiconv
brew link libxml2 libxslt libiconv

gem install nokogiri -- \
--with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 \
--with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib \
--with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 \
--with-iconv-include=/usr/local/Cellar/libiconv/1.14/include \
--with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib

If the problem still persists it's likely to be the build tools that are out of version or missing. If you replace the gcc with the gcc-4.2 the problem should go away.

sudo ln -s /usr/bin/gcc-4.2 /usr/bin/gcc