In order to use rvm (https://rvm.beginrescueend.com/), I need to run
source ~/.bash_profile
each time when I start a new shell. How do I automatically do this when I start my computer, rather than having to type it each time?
This is my .bash_profile:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# Load RVM into a shell session *as a fu nction*
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# Load RVM function
A few options here:
source ~/.bash_profile
to ~/.bashrc.[ -e ~/.bash_profile ] && source ~/.bash_profile
to your /etc/bashrcsudo
orsu
), specify that you want a login environment to be loaded (e.g. withsu -
instead of justsu
).Background: .bash_profile is specific to login shells, whereas .bashrc is loaded by all shells. So you're either missing the logic that causes .bash_profile to be loaded in the first place, or you're not launching a login shell when you're launching your shell.
At the end of my .bash_profile I have this line:
source ~/.rvm/scripts/rvm
I tried using what you have in your bash profile (which is part of the instructions for setting up rvm) but I could never get it to work.