You don't have write permissions into the /var/lib/gems/1.9.1 directory

大兔子大兔子 提交于 2019-12-18 16:34:21

问题


I got this error, for all gem that I try to install:

ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /var/lib/gems/1.9.1 directory.

obs. I'm running on Ubuntu 14.


回答1:


According the question I see a few steps in order to allow writing to /var/lib/gems:

  1. Create gems (if not any) group, and add yourself to the group:

    $ groupadd -f gems
    $ usermod -aG gems $(whoami)
    
  2. When reenter to the session:

    $ sudo -u $(whoami) bash
    
  3. 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/
    
  4. Try installing gems into /var/lib/gems/.

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.




回答2:


Either run with sudo or if that doesn't work, try sudo chmod +w <file> (from terminal separately)



来源:https://stackoverflow.com/questions/27475311/you-dont-have-write-permissions-into-the-var-lib-gems-1-9-1-directory

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