ERROR: While executing gem … (Gem::FilePermissionError)

纵饮孤独 提交于 2019-12-22 09:48:36

问题


$ gem install passenger
Fetching: passenger-4.0.5.gem (100%)
ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Users/snowcrash/.rvm/gems/ruby-2.0.0-p195 directory.
$ ls -ld /Users/snowcrash/.rvm/gems/ruby-2.0.0-p195
drwxrwsr-x  8 root  rvm  272 21 May 16:07 /Users/snowcrash/.rvm/gems/ruby-2.0.0-p195

Clearly my version of ruby is owned by root/rvm.

I'm not happy with this SO answer which suggests making .gem/specs world-writable: Permission denied error with RVM

and this SO answer is for a specific gem: Error while executing gem...Permission Denied

Any better suggestions?

Perhaps repair permissions / ownership on the .rvm directory?


回答1:


RVM has a command to fix permissions:

rvm get head
rvm fix-permissions



回答2:


You can try to take ownership of the .rvm directory with something like:

sudo chown -R groupname:username /Users/username/.rvm

Where username is your user login name. The groupname is optional.



来源:https://stackoverflow.com/questions/17248872/error-while-executing-gem-gemfilepermissionerror

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!