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
Written by Felipe Brandão
Related protips
3 Responses
dica legal, claramente explicado, vlw!
@amalrik vlw! tks!
You can also put source ~/.bashrc in your .bash_profile, if you still need the distinction but want the bashrc to always be sourced.