“宝石安装轨道”在Mac OS X上使用rbenv给FilePermissionError [英] "gem install rails" give FilePermissionError with rbenv on mac OS X

查看:92
本文介绍了“宝石安装轨道”在Mac OS X上使用rbenv给FilePermissionError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了关于此问题的所有其他Stackoverflow帖子,但没有看到任何适用于rbenv的解决方案,所以我将在此处发布它。 (大多数其他帖子建议使用RVM,或者OP已经运行了 sudo gem install rails )。



当我运行 gem install rails (没有 sudo )时,我得到

 错误:执行gem时(Gem :: FilePermissionError)
您没有写入/Library/Ruby/Gems/2.0权限。 0目录。




  1. / Library / Ruby /Gems/2.0.0 正确的位置?


  2. 为什么我得到这个错误?我在一台没有多少安装的新笔记本电脑上。

我得到了自制软件,rbenv和ruby 2.0

解决方案

rbenv不应该试图安装到您的系统安装的Ruby。如果你检查 /Library/Ruby/Gems/2.0.0 的权限,你会发现它是由root拥有的,这意味着你需要sudo来写入它,这是我们试图避免的。



这表明,要么


  1. 你的rbenv安装有问题,因为它应该看着 /Users/whoami/.rbenv/versions/2.0.0 。正如您在其文档中看到的那样。我确认你的rbenv运行正常,或者尝试重新安装,以确保你的rbenv安装ruby是优先的。

  2. 你的系统ruby可能会破坏你的rbenv。你确定你的系统ruby在你的路径中没有优先吗?尝试使用已安装的gem运行 gem list rake -d ,以查看当前安装的宝石的位置。


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

解决方案

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

这篇关于“宝石安装轨道”在Mac OS X上使用rbenv给FilePermissionError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆