An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue

3.2k views Asked by At

While executing sudo bundle install I am getting the following error. Gem files will remain installed in /Users/madhakul/Documents/Inshort/puurna/vendor/cache/ruby/2.3.0/gems/nokogiri-1.6.6.2 for inspection. Results logged to /Users/madhakul/Documents/Inshort/puurna/vendor/cache/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/nokogiri-1.6.6.2/gem_make.out

An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue. Make sure that gem install nokogiri -v '1.6.6.2' --source 'https://rubygems.org/' succeeds before bundling.

In Gemfile: roo was resolved to 2.0.0, which depends on

After going through a few help materials, I have installed Developer Tools for MacOS 10.14 Mojave, but still I am not able to resolve the issue.

2

There are 2 answers

0
Kᴏɴsᴛᴀɴᴛɪɴ Sʜɪʟᴏᴠ On
brew install libxml2

gem install nokogiri -v '1.6.6.2' -- --use-system-libraries \
  --with-xml2-include=$(brew --prefix libxml2)/include/libxml2

Documentation

0
Tim Higgins On

I recently had to install Nokogiri 1.6.6.2 as well and ran into the same issue (also on Mojave 10.14). I tried installing xcode-select first, but that alone didn't solve it. Further down in the install guide (as @xploshioOn linked https://nokogiri.org/tutorials/installing_nokogiri.html) is where I found the answer that helped me; installing the extra headers.

A temporary workaround to allow previous releases of Nokogiri to build is to install the extra headers package mentioned in the Xcode 10 release notes:

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

That'll open a window where you can then run through the installation prompt for the extra headers to run previous versions of Nokogiri.