Why do “gem” and “sudo gem” have different installation directories?

前端 未结 1 480
臣服心动
臣服心动 2021-01-01 04:38

I remember I used gem install rails to install Rails, but today when I want to install another gem, by typing

gem install ruby-recaptcha
         


        
相关标签:
1条回答
  • 2021-01-01 05:20

    RVM uses environment variables to configure rubygems - the gem command, basically if you have user installation (~/.rvm) you should not need to use to call any commands with sudo, especially gem - that if worked would install rail as root user in your home directory, making it impossible for you to manage your files ... if you have any good reasons to use sudo - use rvmsudo instead - but really you should not have that need, especially to install gems.

    If you want to have some commands available in your system (like gist) you can use rvm wrapper and link generated binary in /usr/bin

    to fix permissions in your home:

    sudo chown $USER: ~/.rvm
    sudo chmod u+rw ~/.rvm
    
    0 讨论(0)
提交回复
热议问题