rvm switches to old ruby version after reboot against default set

Every time I startup my computer (Ubuntu 12.04 LTS), it loads ruby 1.8.7, even when ruby 2.1.1 is set as =* - current && default (upon rvm list ).

To change the version I use rvm use ruby-2.1.1

However, every single time I use the use command, I get the popular error message RVM is not a function... .

So, again every single time, I have to follow the same steps, ie first type [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" and only then switch to ruby-2.1.1 with rvm use ruby-2.1.1 . Then, also Rails switches automatically from 2-something to 4.1.4.

  • How can I convince my machine to stay with the head versions even after reboot?
  • What does the [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" [[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" do and how do I understand this syntax? (I can't see any command here, really - just the parameter -s)

  • You can make rvm known to your bash sessions simply by updading your .bashrc :

    echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc.

  • (Info: Your problem was that you invoked the previous scripts and the changes they made lasted only for your current bash session. Now it's executed every time you open bash)

  • $HOME stands for /home/<>. So in your home folder there is a .rvm directory where a scripts directory is included. The "command" here is the script rvm. Hope it helps

  • Your problem is that RVM is not loaded when you open a terminal, you have to manually add the source at each instance of the Terminal.

    You need to add rvm source to the bashrc or bash_profile to resolve this issue.

    Open terminal:

    echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile

    Or this (if using non-login shell):

    echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc

    This will add the path to RVM to load at each Terminal instanciation (close & re-open a terminal after you did this).

    链接地址: http://www.djcxy.com/p/63414.html

    上一篇: 如何在TeamCity上使用NUnit运行参数化Selenium测试?

    下一篇: 根据默认设置重新启动后,rvm切换到旧的ruby版本