7

I have had rails installed and almost working. Was working on a solution to another problem with I accidentally closed the bash window. So I reopened it, and now I am unable to use rails at all and it's telling me that rails isn't installed. So I ran gem install rails --no-ri --no-rdocand now I get the following:

ERROR:  While executing gem ... (Errno::EEXIST)
File exists @ dir_s_mkdir - /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems`

How do I correct this error?

Hizqeel
  • 947
  • 3
  • 20
  • 23
trick420
  • 237
  • 3
  • 9

7 Answers7

7

I just removed the broken gems, site_ruby and vendor_ruby symlinks from the /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/ folder and now everything seems to work fine.

Samuel
  • 471
  • 4
  • 7
2

I just added a gems/ directory here /usr/local/lib/ruby/ and that solved the issue.

JamieR
  • 21
  • 2
1

for a temporary solution, you can mkdir -p /usr/local/Cellar/ruby/2.1.1_1/lib/ruby/gems/2.1.0 to solve.

C.C.
  • 1,060
  • 3
  • 13
  • 25
0

When you open your bash window (called the "terminal window" or "console"), what folder ("directory") are you in? Find out with:

$ pwd

Navigate to the folder where you created your Rails project using the Unix cd command, for example:

$ cd workspace/learn-rails

If you are using RVM, make sure you have selected the correct gemset:

$ rvm gemset list

gemsets for ruby-2.1.1 (found in ...)
   (default)
   global
=> learn-rails

Then see if Ruby and Rails are installed:

$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
$ rails -v
Rails 4.1.0

Refer to the article Install Ruby on Rails for help. If you haven't followed all the steps in the article, you may have problems, especially if you followed some of the inaccurate instructions found elsewhere on the web.

Daniel Kehoe
  • 10,952
  • 6
  • 63
  • 82
0

I was recently in this wormhole. It seems like Homebrew's ruby installation has an issue with soft links and uses version 2.1.1. I couldn't "gem install" anything without getting the annoying "File exists @ dir_s_mkdir" error. Even tried MacPort and that was a nightmare.

First uninstall ruby via

brew uninstall ruby

or

port uninstall ruby

And follow the instruction on https://rvm.io/rvm/install to install ruby

\curl -sSL https://get.rvm.io | bash -s stable --ruby

It might then complain about ruby-2.0.0-p353 not installed

To install do:

rvm install ruby-2.0.0-p353

Then run the rvm install script. Your "gem install << whatever >>" should now work

Jack
  • 419
  • 2
  • 5
0

This fixed the issue for me (Homebrew on a Mac, Ruby 2.1.3):

$ brew reinstall ruby $ brew unlink ruby && brew link ruby

Glutexo
  • 547
  • 6
  • 13
0

the same issue. I just remove dir_s_mkdir, then pod install. it works for me!

responser
  • 432
  • 4
  • 7