3
$ 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?

Community
  • 1
  • 1
Snowcrash
  • 80,579
  • 89
  • 266
  • 376

3 Answers3

11

RVM has a command to fix permissions:

rvm get head
rvm fix-permissions
mpapis
  • 52,729
  • 14
  • 121
  • 158
0

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.

Rob O
  • 3
  • 2
Ian Kenney
  • 6,376
  • 1
  • 25
  • 44
0

Using the principle of Less Complexity, the obvious answer was:

sudo gem install passenger

If you start using rvm or rbenv then you start going down the path of additional complexity.

Then you start running into all the problems they create.

Snowcrash
  • 80,579
  • 89
  • 266
  • 376