Error Installing Nokogiri: Failed to Build Gem Native Extension & Libiconv Is Missing (Osx)

Why does installing Nokogiri on Mac OS fail with libiconv is missing?

I had the same issue. Unfortunately the "Installing Nokogiri" doesn't cover Iconv issues. Here's how I resolved the issue.

First install homebrew, it'll make your life easier. If you already have it installed, be sure to grab the latest formulae by updating like so:

brew update

Note: In OSX 10.9+ you may need to install xCode command tools to allow you to install libiconv.

xcode-select --install

then install a newer version of libiconv

brew install libiconv

then install your gem

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

Why does installing Nokogiri on Mac OS fail with libiconv is missing?

I had the same issue. Unfortunately the "Installing Nokogiri" doesn't cover Iconv issues. Here's how I resolved the issue.

First install homebrew, it'll make your life easier. If you already have it installed, be sure to grab the latest formulae by updating like so:

brew update

Note: In OSX 10.9+ you may need to install xCode command tools to allow you to install libiconv.

xcode-select --install

then install a newer version of libiconv

brew install libiconv

then install your gem

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

Failure to install nokogiri libiconv is missing on Yosemite Mac OS X 10.10

The nokogiri install tutorial provides the solution:

# bash
brew unlink gcc
gem uninstall nokogiri
xcode-select --install
gem install nokogiri

If you don't have Xcode 6.1, yet, you may install it from the apple developer download site (section additional tools), as described in this blog post.

Error installing Nokogiri gem on Mac OS X

If you are using brew use this in the terminal:

brew unlink gcc-4.2      # you might not need this step
gem uninstall nokogiri
xcode-select --install
gem install nokogiri

If this didn't work please check "Installing Nokogiri on OSX 10.10 Yosemite"



Related Topics



Leave a reply



Submit