Nokogiri won't install? Check that you have accepted Xcode's EULA

An non obvious reason for being unable to install updates to Nokogiri

Here is a pro tip I never thought I would need to share!

For Nokogiri to install on OSx out of the box it requires some of the command line tools that come with xCode. I have everything like that installed because I have had to install things like Nokogiri several times in the past.

Today though I was getting this error message that suggested that I didn't have those required tools installed.

Building native extensions.  This could take a while...
Building nokogiri using packaged libraries.
ERROR:  Error installing nokogiri:
	ERROR: Failed to build gem native extension.

    /Users/tobyosbourn/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
checking for iconv.h... *** 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.

10 minutes of yak shaving later and I decided to open up xCode to see what the craic was, turns out a point release had been downloaded and installed and came with a new EULA, as soon as I accepted this I was able to install the nokogiri gem successfully!


Recent posts View all

Ruby SEO

SEO for Ruby on Rails projects

How to do technical SEO with your Ruby on Rails application

Ruby

Converting images to use Google's webp format

A quick guide to using Google's command line tool to convert images to webp format