RVM doesn't switch Rubies

后端 未结 5 502
一生所求
一生所求 2020-12-24 07:51

I\'m running Ruby 1.9.1p243 on CentOS, and I decided to install rvm to handle upgrading to 1.9.2 or downgrading to 1.8.7 (whichever turns out to work better for rails3).

相关标签:
5条回答
  • 2020-12-24 08:06

    I've been struggling with setting default rvm ruby to no avail, until I've tried this:

    sudo bash -l -c 'rvm alias create default ruby-1.9.3-p392'
    

    "sudo" is for writing into /usr/local/rvm/config/alias (in my example it would contain "default=ruby-1.9.3-p392")
    "bash -l" is to make sure it runs all the scripts (/etc/profile, /etc/bash.bashrc, etc..) of login shell

    0 讨论(0)
  • 2020-12-24 08:12

    Your install is as root account. Try this in shell [[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"

    before rvm switch operation. I add this line in my profile file and now all is ok.

    0 讨论(0)
  • 2020-12-24 08:18

    Can be a problem of Terminal and you should try to close your Terminal's window and to open new one. :) Try again to see if it has changed...

    0 讨论(0)
  • 2020-12-24 08:24

    Typically rvm support is easiest via IRC (#rvm on freenode) - in this particular case, what does running "type rvm | head -n1" show? it should show "rvm is a function". If not, that means the line to source rvm isn't being run correctly and hence switching doesn't work. Typically this means you either have a return in your ~/.bashrc or you missed adding the line to source rvm.

    0 讨论(0)
  • 2020-12-24 08:26

    Just came across the same problem.

    Instead of appending the following script to ~/.bash_profile, append it to ~/.bashrc:

    [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

    And then restart the terminal.

    0 讨论(0)
提交回复
热议问题