简体   繁体   English

“ gem安装导轨”在Mac OS X上通过rbenv给出FilePermissionError

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

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. 我已经阅读了有关此问题的所有其他Stackoverflow帖子,但没有找到任何适用于rbenv的解决方案,因此我将其发布在这里。 (most of the other posts suggest either using RVM, or the OP had already ran sudo gem install rails ). (大多数其他文章建议要么使用RVM,要么OP已经运行sudo gem install rails )。

when i run gem install rails (without sudo ), i get 当我运行gem install rails (没有sudo )时,我得到了

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? /Library/Ruby/Gems/2.0.0是正确的位置?

  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 我有自制软件,rbenv和ruby 2.0

rbenv should not be trying to install to your System install of Ruby. rbenv不应尝试将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. 如果检查/Library/Ruby/Gems/2.0.0上的权限,您会看到它是root拥有的,这意味着您需要sudo对其进行写入,我们正尝试避免这种情况。

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 . 您的rbenv安装有问题,因为它应该查看/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. 我会确认您的rbenv运行正常,或者尝试重新安装以确保优先安装ruby的rbenv。
  2. Your system ruby might be clobbering your rbenv. 您的系统红宝石可能正在破坏您的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 尝试使用已安装的gem运行gem list rake -d ,以查看当前gem的安装位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM