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

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'

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.