Tuesday, October 18, 2011

Problem with gmkdir when updating gems

Quick note on a problem I was seeing when I was trying to update gems in an rvm setup.

ruby-1.9.2-p290@demo ~: gem update
[...]
make install
/opt/local/bin/gmkdir -p /Users/crusso/.rvm/gems/ruby-1.9.2-p290@demo/gems/json-1.6.1/ext/json/ext/json/ext
make: /opt/local/bin/gmkdir: No such file or directory
make: *** [/Users/crusso/.rvm/gems/ruby-1.9.2-p290@demo/gems/json-1.6.1/ext/json/ext/json/ext] Error 1

I had no gmkdir in /opt/local/bin... no gmkdir at all. Previously, I had been using Macports, so I guess that ruby gems had cached the location to gmkdir.

Rather than blowing away my whole rvm installation and starting over, I installed the coreutils module with brew:

brew install coreutils
That includes gmkdir, but not in the right spot. So, I created a symbolic link to it:

sudo ln -s /usr/local/bin/gmkdir /opt/local/bin/gmkdir

Let me know if this problem was plaguing you and this helped.

10 comments:

  1. Thank you for saving me a ton of time! Worked great!

    ReplyDelete
  2. symlink not necessary...

    Thanks for the writeup. I had this same problem and running `brew install coreutils` helped me.

    However, I don't have a /opt/local/ because I got rid of macports. And I found that, since I was using brew, it was looking for "gmkdir" because it looks for all those typical commands except with a "g" infront (that's what it tells you after you run `brew install coreutils`. After I ran that and made sure it was in my .zshrc (.bashrc, etc.) and ran my command again that started this all, it ran fine (probably because it found gmkdir in my path.

    Thanks,
    R

    ReplyDelete
  3. I also just ran into this problem, and I needed the symlink for both gmkdir and ginstall, but now it seems to be working
    Thanks!

    ReplyDelete
  4. You might also want to link install to ginstall (same directories, I suppose). In my install, the commands were:

    sudo ln -s /bin/mkdir /opt/local/bin/gmkdir
    sudo ln -s /usr/bin/install /opt/local/bin/ginstall

    Needed both to get the debugger gem to compile.

    ReplyDelete
  5. Thank you, this helped me 4 years after you posted this (didn't even have to symlink). I have upgraded to Ruby 2.2.5 and bundle failed to install json 1.8.3.

    ReplyDelete
  6. This fixed my failing installation for Nokogiri 1.5.11 for Ruby 2.1.9 on my OSX 10.11.5. Thanks! Didn't follow the symlink instructions but it works.

    ReplyDelete