RVM installed by Ruby not working?

前端 未结 10 1258
不知归路
不知归路 2020-12-04 23:36

I installed RVM using the single instruction mentioned at the RVM website (using git).

Then I installed Ruby version 1.9.2 and 1.8.7 using:

rvm insta         


        
10条回答
  •  一向
    一向 (楼主)
    2020-12-05 00:23

    Are you making sure to source /usr/local/lib/rvm? echo 'source /usr/local/lib/rvm' >> ~/.bashrc and relog via SSH/start a new instance of Bash.


    To clarify, since there is some confusion: there are two ways to install RVM: a "per user" install, and a "system wide" install.

    For most day-to-day use, you want to use a "per user" install, which installs RVM into ~/.rvm. System-wide installs are good for servers, where one set of Rubies should be used. The default location for RVM in this case is /usr/local/rvm.

    Based on your question, it appears you've installed RVM as a system-wide install.

    To use RVM, it must be initialized by running a script each time you log in. To do this easily, you include the file in your ~/.bashrc file (or ~/.bash_profile if you're on OS X), so that it is automatically run each time you log in. For a per user install, add the following text to the file:

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
    

    for system wide installs, use this text instead:

    [[ -s "/usr/local/lib/rvm" ]] && . "/usr/local/lib/rvm"
    

    If you do indeed have a system-wide install, you will also need to make sure you are a member of the rvm group; type the following to do so:

    sudo adduser `whoami` rvm
    

    Once you have made the necessary changes, log out of your session and then log back in. Once you have done so, rvm use 1.9.2 should set a bunch of environment variables, which you can see by typing rvm info. If all is well, ruby should execute correctly.

提交回复
热议问题