Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In order to use rvm (, 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
share|improve this question
up vote 2 down vote accepted

A few options here:

  1. Put the contents of your .bash_profile in ~/.bashrc.
  2. Add source ~/.bash_profile to ~/.bashrc.
  3. Add [ -e ~/.bash_profile ] && source ~/.bash_profile to your /etc/bashrc
  4. If you are switching users (e.g. with sudo or su), specify that you want a login environment to be loaded (e.g. with su - instead of just su).

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.

share|improve this answer
thanks! it works! "Add source ~/.bash_profile to ~/.bashrc." – larry May 12 '11 at 3:41

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.