RVM Command: source ~/.rvm/scripts/rvm

最后都变了- 提交于 2019-11-30 11:27:17

问题


I'm going through the rails by example tutorial series. I'm trying my best to find solutions prior to asking questions, so if I have missed anything I apologise.

Every time I need to boot up RVM from the command line in terminal I need to punch a command so that RVM initialises: source ~/.rvm/scripts/rvm

Is this normal? It seems that I cant get the RVM commands to work unless I punch in this code prior. Note I only have to enter the command once, not every time I need to enter an RVM command.

Many thanks for your help.


回答1:


Put this in your ~/.profile or ~/.bashrc:

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

So you don't have to manually type it for every session.




回答2:


Further Tip

If you want to use gnome terminal (comes as standard in Ubuntu) with rvm, you can do the following:

  • Edit the default profile. Check the following setting:

    "Run command as a login shell"
    
  • This will stop loading the standard .bashrc by default. Fix this by making a soft link of .rvmrc pointing at .bashrc in your home directory

    cd
    ln -s .bashrc .rvmrc
    



回答3:


Try closing terminal & then re-opening it to install a specific version of ruby:

https://www.youtube.com/watch?v=THG3BKy6JEI at 2:32

For example) I typed in "curl -L https://get.rvm.io | bash -s stable --ruby"

Then I quit terminal & reopened terminal & typed in "rvm install 2.2.3" & it worked :D :)



来源:https://stackoverflow.com/questions/4842566/rvm-command-source-rvm-scripts-rvm

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