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/dupes
brew install libxml2 libxslt
brew 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/

Leave a Comment