简体   繁体   中英

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

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.

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM