如果由于权限错误而失败,如何安装 gem 或更新 RubyGems [英] How to install a gem or update RubyGems if it fails with a permissions error

查看:20
本文介绍了如果由于权限错误而失败,如何安装 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.

有人知道如何解决这个问题吗?

Does anyone have an idea how to solve this?

推荐答案

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

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.

这是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.

相反,我强烈建议您考虑使用 rbenvRVM 管理一个单独的 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 或更新 RubyGems的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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