Last Updated: February 25, 2016
·
2.749K
· felipebrnd

OSX .bashrc and .bash_profile

On OSX .bashrc and .bash_profile are loaded in distinct moments:

The first when you are in a non-login shell
The later when you are in a login shell

So if you have only .bashrc whatever you have in it won't be executed when you simply, for example, open iTerm and you'll have to load it by yourself:

source ~/.bashrc

You can test the difference by opening a bash session and you'll find that now your .bashrc was loaded without you loading it by yourself:

bash

My way to get around this, as i don't need different stuff on a non-login or login shell , is just make a symbolic link between rc and profile:

cd ~/
ln -s .bashrc .bash_profile

3 Responses
Add your response

dica legal, claramente explicado, vlw!

over 1 year ago ·

@amalrik vlw! tks!

over 1 year ago ·

You can also put source ~/.bashrc in your .bash_profile, if you still need the distinction but want the bashrc to always be sourced.

over 1 year ago ·