安装gem或更新RubyGems失败并出现权限错误 [英] Installing gem or updating RubyGems fails with permissions error

查看:1192
本文介绍了安装gem或更新RubyGems失败并出现权限错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试安装gem( gem install mygem )或更新RubyGems( gem update --system )失败出现此错误:

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

任何人有想法如何解决这个问题?

解决方案 div>


您没有写入/Library/Ruby/Gems/1.8目录的权限。


的意思就是,你没有写权限。



这是Apple为他们自己安装的Ruby版本。如果你知道你在做什么,可以对进行微小的修改,因为你不确定权限问题,所以我认为继续沿着这条轨道是不是一个好主意。



相反,我会强烈建议您考虑使用 rbenv RVM 来管理安装在主目录沙箱中的单独Ruby ,您可以修改/折叠/主轴/更改,而不用担心搞乱Ruby系统。



在两者之间,我使用rbenv,尽管我使用了RVM过去。 rbenv采取更放手的方式来管理您的Ruby安装。 RVM具有许多功能,功能非常强大,但结果更具侵入性。无论哪种情况,在开始安装无论您选择哪个安装文件之前,先阅读安装文档。


Trying to install a gem (gem install mygem) or update RubyGems (gem update --system) fails with this error:

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

Anyone having idea how to solve this?

解决方案

You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

means exactly that, you don't have permission to write there.

That is the version of Ruby installed by Apple, for their own use. While it's OK to make minor modifications to that if you know what you're doing, because you are not sure about the permissions problem, I'd say it's not a good idea to continue along that track.

Instead, I'll strongly suggest you look into using either rbenv or RVM to manage a separate Ruby, installed into a sandbox in your home directory, that you can modify/fold/spindle/change without worrying about messing up the system Ruby.

Between the two, I use rbenv, though I used RVM a lot in the past. rbenv takes a more "hands-off" approach to managing your Ruby installation. RVM has a lot of features and is very powerful, but, as a result is more intrusive. In either case, READ the installation documentation for them a couple times before starting to install whichever you pick.

这篇关于安装gem或更新RubyGems失败并出现权限错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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