wmsyua
Last Updated: February 25, 2016
·
1.816K
· felipebrnd
35cc187075b514ffdbcc6b006b69714c

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
Say Thanks
Respond

3 Responses
Add your response

1483
29912acf4124f78d29de7a0f5adf89d0

dica legal, claramente explicado, vlw!

over 1 year ago ·
1484
35cc187075b514ffdbcc6b006b69714c

@amalrik vlw! tks!

over 1 year ago ·
1488
36b4b730bc6d058fd0737fc44119ed6f

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 ·
Filed Under