问题
$ 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