“gem install rails” give FilePermissionError with rbenv on mac OS X

别等时光非礼了梦想. 提交于 2020-01-13 06:35:26

问题


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


回答1:


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


来源:https://stackoverflow.com/questions/23509129/gem-install-rails-give-filepermissionerror-with-rbenv-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!