RVM isn't recognized until I run “source ~/.profile” in terminal

霸气de小男生 提交于 2020-01-22 16:47:28

问题


sergio@sergio-VirtualBox:~/code$ rails -v
The program 'rails' is currently not installed.  You can install it by typing:
sudo apt-get install rails

sergio@sergio-VirtualBox:~/code$ source ~/.profile

sergio@sergio-VirtualBox:~/code$ rails -v
Rails 3.2.1

Any ideas why the command doesn't work until I run "source ~/.profile"? I would like to not have to do this every time I run my machine or open a new terminal window.


回答1:


RVM provides quite good description https://rvm.io/support/faq/#shell_login

you should use .bash_profile - unless you have good reasons against it - but I do not know many.

Rvm puts a sourcing line in one of your RC files, in your case it was .profile, you should remove that line, create .bash_profile, and update rvm:

sed -i '/source.*rvm/ d' ~/.profile
touch ~/.bash_profile
rvm get head --auto-dotfiles



回答2:


Your shell isn't loading your ~/.profile. Probably it is loading ~/.bashrc or ~/.bash_profile or one of a few other possible things. Consult the documentation for your shell, or run it under strace to see what files it loads when it starts.



来源:https://stackoverflow.com/questions/9106635/rvm-isnt-recognized-until-i-run-source-profile-in-terminal

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