Max Peng
Max Peng

Reputation: 3227

gem install nokogiri -v '1.5.11' failed due to make: /usr/local/bin/gmkdir: No such file or directory

Ruby version: 2.2.5

Mac OSX: 10.11.5

Gem version: 2.4.8

Bundler version: 1.12.5

When I run gem install nokogiri -v '1.5.11', I got the following error:

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

/Users/hwpeng/.rvm/rubies/ruby-2.2.5/bin/ruby -r ./siteconf20160707-31800-1ejznjc.rb extconf.rb

====ignored multiple lines====

make "DESTDIR=" install
make: /usr/local/bin/gmkdir: No such file or directory
make: *** [.RUBYARCHDIR.-.nokogiri.time] Error 1

make install failed, exit code 2

Upvotes: 21

Views: 6616

Answers (3)

Touseef Murtaza
Touseef Murtaza

Reputation: 1956

The issue is not directly linked with the nokogiri. It is more around the missing libraries in the system. I am using Mac M1 machine and moving data/libraries from Intel to M1 is a pain. So for me after spending hours I fixed the issue. Steps which I followed to fix library issues are:

  • Uninstall and install Homebrew
  • Update the proper PATH in .zshrc or .bachrc file
  • install the coreutils brew install coreutils
  • close the terminal and then run the bundle install

Credit for coreutils help: http://thoughtsthatleakedout.blogspot.com/2011/10/problem-with-gmkdir-when-updating-gems.html

Upvotes: 1

Max Peng
Max Peng

Reputation: 3227

I noticed the error message said: make: /usr/local/bin/gmkdir: No such file or directory.

I searched this in google and found a similar post but for cocopods: https://coderwall.com/p/ehijxg/fixing-error-installing-cocoapods-on-macos

The following commands solved my problem. If you have a different error message, please refer to http://www.nokogiri.org/tutorials/installing_nokogiri.html

Homebrew

brew install coreutils
gem install nokogiri -v '1.5.11'

MacPorts

sudo port install coreutils
gem install nokogiri -v '1.5.11'

Upvotes: 57

Khanh Pham
Khanh Pham

Reputation: 2973

I had this problem last time and you can try this code:

gem install nokogiri -v 1.5.11 -- --use-system-libraries

I think it will work.

Upvotes: 3

Related Questions