Search code examples
rubypermissionsrubygemsrbenv

Should root own files in rbenv directories?


Today I was trying to install a jekyll's gem using:

gem install jekyll

And I got some permission errors:

$ gem install jekyll
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Errno::EACCES)
Permission denied @ dir_s_mkdir -  /Users/myuser/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/ffi-1.9.10

Well, I checked and indeed that file as well as a lot of other ones are owned by root.

Is that correct? Should root own files under rbenv's root directory? Can I fix this by using chown recursively to change everything under ~/.rbenv to my user?


Solution

  • No, root should not own any file in ~/.rbenv. Probably it caused by some unneeded sudo usage. You can safely chown the files in the directory.