如何安装gem或更新RubyGems

如何安装gem或更新RubyGems

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

问题描述

我正在尝试使用gem install mygem安装gem或使用gem update --system更新RubyGems,但失败并出现以下错误:

I'm trying to install a gem using gem install mygem or update RubyGems using gem update --system, and it 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.

有人知道如何解决吗?

推荐答案

确切地说,您无权在此处写信.

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

这是Apple安装的供自己使用的Ruby版本.如果您知道自己在做什么,可以对该进行较小的修改,但是由于您不确定权限问题,我认为继续沿这条路线前进不是一个好主意.

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.

相反,我强烈建议您使用 rbenv RVM 来管理安装在主目录中沙箱中的单独Ruby,您无需修改​​/折叠/旋转/更改即可担心弄乱系统Ruby.

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.

在这两者之间,我使用了rbenv,尽管过去我经常使用RVM. rbenv采用了一种更为轻松"的方法来管理您的Ruby安装. RVM具有许多功能,并且功能非常强大,但因此更具侵入性.无论哪种情况,在开始安装您选择的任何一种软件之前,都要阅读它们的安装文档两次.

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因权限错误而失败,如何安装gem或更新RubyGems的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 22:14