Ask Different is a question and answer site for power users of Apple hardware and software. 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

When ever I close and open, it never loads my ~/.bash_profile. I have my RVM setup at the top of the file but it never loads it.

As you can see, when I type rvm into Terminal, it says command not found this is a pain as I have to run source ~/.bash_login every time I open Terminal.

rvm command not found

Am I the only one with this problem? What am I doing wrong?

share|improve this question
Out of curiosity, what does your Terminal preferences window, under the 'Startup' tab look like? – Jason Salaz Aug 16 '11 at 20:03
They show this: – Dean Perry Aug 16 '11 at 20:08
Strange, considering the bash man page: When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior. And that /usr/bin/login setting is self-explanatory... – Jason Salaz Aug 16 '11 at 20:55
"it never loads my ~/.bash_profile" "I have to run source ~/.bash_login" Which is it? Are you using ~/.bash_profile or ~/.bash_login? Only one of them will be run. – Chris Page Aug 19 '11 at 11:21
up vote 2 down vote accepted

Does it have to be .bash_login? Try renaming it to .profile.

share|improve this answer
Or .bash_profile - which works – Rene Larsen Aug 14 '11 at 17:34
Looks like renaming to .profile worked. Thanks – Dean Perry Aug 14 '11 at 17:35
This is very surprising. ~/.bash_login should work just as well as ~/.bash_profile. It works for me. You can put an echo .bash_login at the start of ~/.bash_login to see whether it gets run. Of course, it won't be run if you also have ~/.bash_profile. – Chris Page Aug 19 '11 at 11:26

Bash only reads the .bash_login file if it's started as a login shell (was passed the --login flag). Try renaming it to .bashrc instead, which is evaluated when bash was invoked as an interactive shell without the --login flag.

share|improve this answer
I have tried .bashrc but it does the same – Dean Perry Aug 14 '11 at 17:29
Prior to Lion, Terminal creates login shells unless you provide a custom command in Preferences > Startup or Preferences > Settings > [profile] > Shell. As of Mac OS X Lion 10.7, Terminal always creates login shells, even for custom commands, if they're listed in /etc/shells. – Chris Page Aug 19 '11 at 11:15

Make sure your .bash_login script doesn't contain relative paths like

source .profile

Change to

source ~/.profile

Lion changes the directory to your current tab or where your last session is, so all paths have to be absolute now.

share|improve this answer

For me bash in Lion does not load ~/.profile either.

Adding source ~/.profile command to run at startup in shell preferences helped, but is quite unelegant.

share|improve this answer
Check your preferences to ensure you haven’t done something to suppress the creation of a login shell. Is anything in Terminal > Preferences > Settings > [profile] > Shell > Startup or Terminal > Preferences > Startup > Shells open with customized? – Chris Page Mar 10 '12 at 23:06

Changing .bashrc from

source .bash_profile


source ~/.bash_profile

did the trick for me.

share|improve this answer
I recommend going the other direction: Have ~/.bash_profile source ~/.bashrc. Put all the stuff you want to be common to login and non-login shells into ~/.bashrc. ~/.bash_profile should only contain configuration commands for login shells. – Chris Page Sep 8 '11 at 11:55

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.