Question

I've read all the other Stackoverflow posts on this problem but don't see any suitable solution for rbenv, so i'll post it on here. (most of the other posts suggest either using RVM, or the OP had already ran sudo gem install rails).

when i run gem install rails (without sudo), i get

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
  1. is /Library/Ruby/Gems/2.0.0 the correct spot?

  2. why am i getting this error? i'm on a fresh laptop that hasn't had much install.

i've got homebrew, rbenv, and ruby 2.0

Was it helpful?

Solution

rbenv should not be trying to install to your System install of Ruby. If you check the permissions on /Library/Ruby/Gems/2.0.0 you'll see it's owned by root, which means you'll need to sudo to write to it, which we're trying to avoid.

This suggests that either

  1. There is something wrong with your rbenv installation, because it should be looking at /Users/whoami/.rbenv/versions/2.0.0. As you can see in their documentation. I'd confirm that your rbenv is operating correctly or maybe try reinstalling to make sure your rbenv installation of ruby is taking priority.
  2. Your system ruby might be clobbering your rbenv. Have you made sure that your system ruby isn't taking precedence in your path? Try running gem list rake -d with a gem you already have installed to see where your gems are currently installed
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top