Accidental Technologist

Musings about Entrepreneurship, Technology and Software Development

  • Home
  • About
  • Still River Software
  • Privacy Policy

Powered by Genesis

You are here: Home / Ruby / Fixing Nokogiri Installation on macOS Sierra

Fixing Nokogiri Installation on macOS Sierra

October 1, 2016 by Rob Bazinet 5 Comments

Tweet

Nokogiri seems to be the source of many problems on my Mac and after upgrading to macOS Sierra, I wasn’t very surprised to have problem.

Problem

You may get an error similar to:


ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4.

Suggesting using system libraries with:

gem install nokogiri -- --use-system-libraries

Which leads to other less than helpful suggestions.

Solution

It seems after the macOS upgrade and moving to Xcode 8.0, command line tools were not installed.

I was able to get Nokogiri installed by first installing the Xcode command line tools:

xcode-select --install

Then install Nokogiri using the system libraries:

gem install nokogiri -- --use-system-libraries

I hope this helps someone trying to solve a problem that seems should have been solved better by now.

Share this:

  • LinkedIn
  • Twitter
  • Facebook
  • Email
  • More
  • Pinterest
  • Tumblr
  • Pocket
  • Reddit

Related

Filed Under: Ruby Tagged With: nokogiri macos rubygem

Care about your privacy? I do and use Fathom Analytics on this site.

Fathom Analytics

Recent Posts

  • How to Fix Rails Flash Rendering When Using Hotwire
  • Hotwire Fix for CORS Error when using Omniauth
  • Fix Installation of Ruby using rbenv on macOS Big Sur
  • RailsConf 2021 and the Future of Conferences
  • Fixing Out of Diskspace Errors on Amazon EC2

Categories

Services I Love

HatchBox - Easy Rails Deploys Fathom Analytics
Follow @rbazinet

Rob Bazinet
@rbazinet

  • This is so true! I'd love to call out some companies attempting this and making life hard on devs. https://t.co/oNayiZdKlc
    about 4 weeks ago
  • I’m looking for a good Mac client app to backup my Mac to my Synology NAS. Any suggestions? I’m looking for something besides Arq 7.
    about 3 months ago
  • Hotwire Course Early Access is Open https://t.co/GeW2W0HLYI
    about 3 months ago
  • The James Webb Space Telescope is an amazing engineering fest playing out in real-time - https://t.co/FlGn7LXgkY
    about 5 months ago
  • This is pretty slick - https://t.co/iYYbfNELII. Works with Edge on the Mac, but some limitations on Firefox.
    about 6 months ago
  • RSS - Posts
  • RSS - Comments
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.