您没有对/var/lib/gems/1.9.1 目录的写入权限 [英] You don't have write permissions into the /var/lib/gems/1.9.1 directory
问题描述
对于我尝试安装的所有 gem,我收到此错误:
I got this error, for all gem that I try to install:
错误:执行 gem 时 ... (Gem::FilePermissionError)您没有对 /var/lib/gems/1.9.1 目录的写入权限.
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /var/lib/gems/1.9.1 directory.
obs.我在 Ubuntu 14 上运行.
obs. I'm running on Ubuntu 14.
推荐答案
根据问题我看到几个步骤,以便允许写入 /var/lib/gems
:
According the question I see a few steps in order to allow writing to /var/lib/gems
:
创建
gems
(如果没有的话)组,并将自己添加到组中:
Create
gems
(if not any) group, and add yourself to the group:
$ groupadd -f gems
$ usermod -aG gems $(whoami)
重新进入会话时:
When reenter to the session:
$ sudo -u $(whoami) bash
允许为 gems
组写入 /var/lib/gems/
,并设置 setgid
位:
Allow write for a gems
group to /var/lib/gems/
, and set the setgid
bits:
$ chown :gems /var/lib/gems/
$ chmod g+sw /var/lib/gems/
尝试将 gem 安装到 /var/lib/gems/
.
注意:我强烈建议您通过 rbenv/rvm 将它们保存在本地主文件夹中.请参阅答案了解如何正确设置您的项目.
NOTE: I strongly advice you to control rubies and gems via rbenv/rvm keeping them in a local home folder. Please refer to the answer to know how to properly setup your project.
这篇关于您没有对/var/lib/gems/1.9.1 目录的写入权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!