Installing Nokogiri on OSX 10.10 Yosemite Installing Nokogiri on OSX 10.10 Yosemite ruby ruby

Installing Nokogiri on OSX 10.10 Yosemite


I managed to install Nokogiri under Yosemite (OS X 10.10 Preview).

Step 1: Install Brew

Skip this if brew was installed.

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Step 2: Install brew libs

brew tap homebrew/dupesbrew install libxml2 libxsltbrew install libiconv

Step 3: Download and install Apple Commandline Tools for 10.10

It's important that you need to restart after installation.

Link: command_line_tools_for_osx_10_10_june_2014.dmg

After restarted, you can check installation in Terminal:

> xcode-select --install-> xcode-select: error: command line tools are already installed, use "Software Update" to install updates

This error means you have commandline tool installed correctly.

Installing Nokogiri

Try using n previous version 1.6.1 in your Gemfile, version 1.6.2.1 has issues currently with "10.10 Preview". It only works with my rbenv Ruby 2.0.0p247, failed to install on 2.1.1. You can give your existing Ruby versions a couple of tries.

gem install nokogiri  -v '1.6.1' -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/


libxml2 - 1.6.6.2 in Yosemite:

sudo env ARCHFLAGS="-arch x86_64" gem install nokogiri -- --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 --with-xslt-lib=/usr/local/lib --with-xslt-include=/usr/local/include


For Mac OS El Capitan:

gem install nokogiri -v '1.6.7.1' -- --use-system-libraries=true --with-xml2-include=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/libxml2