安装gem失败并出现权限错误 [英] Installing gem fails with permissions error

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

问题描述

我昨天将我的Mac OS升级到10.9小牛。我当前的Ruby版本显示为


ruby​​ 2.0.0p247(2013-06-27 revision 41674)[universal.x86_64-darwin13] p>

我在我的机器上安装了Rails,当我尝试安装宝石时,收到以下消息:

 
获取:eventmachine-1.0.3.gem(100%)
错误:执行gem时(Gem :: FilePermissionError)
You don没有写入/Library/Ruby/Gems/2.0.0目录的权限。

我正在尝试所有这些在我的主目录中。任何建议?

解决方案

使用Ruby版本管理器,如 RVM rvenv



我不能说rbenv,但是RVM在你的 PATH bin 你可以使用$ c>,所以你不必使用 sudo (这是你如何在当前情况下安装gem,但是非常不鼓励)。

rbenv同样适用于您的 $ PATH ,但它使用垫片。


I updated my Mac OS to 10.9 Mavericks yesterday. My current Ruby version shows as

ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]

I got Rails installed on my machine and when I try to install gems I get the following message:

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

I am trying all this in my home directory. Any suggestions?

解决方案

Use a Ruby version manager, like RVM or rbenv.

I can't speak for rbenv, but RVM prepends a Ruby version-specific bin to your PATH that you have access to, so you don't have to use sudo (which is how you could install gems in your current situation, but is highly discouraged).

rbenv similarly prepends to your $PATH, but it uses a shim.

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

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