put some alias commands in my .bashrc
file, so that they might be loaded everytime I open a new Terminal window. Yet this doesn't happen.
I have to select run script:
in the Terminal>Preferences>"MyDefaultTheme">Shell prefpane and add: source .bashrc && clear
for it to work...
This seems odd since many tutorials only say you just have to add to the .bashrc
file and all is good.
Been there, done that. What I came aware of, OS X doesn't read .bashrc
file on bash start. Instead, it reads the following files (in the following order):
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
See also Chris Johnsen's informative and useful comment:
By default, Terminal starts the shell via
/usr/bin/login
, which makes the shell a login shell. On every platform (not just Mac OS X) bash does not use.bashrc
for login shells (only/etc/profile
and the first of.bash_profile
,.bash_login
,.profile
that exists and is readable). This is why "putsource ~/.bashrc
in your.bash_profile
" is standard advice
I usually just put the things that I'd normally put in ~/.bashrc
to ~/.profile
— has worked so far like a charm.
However, this mean that my ~/.profile setups and aliases no longer got loaded! Lots of shortcuts disappeared. I thought they ran sequentially, not exclusively :-/
I added
. ~/.profile
to ~/.bash_login to chain things as I expected.
Sourcing .profile in .bash_profile did it for me
echo 'source ~/.profile' >> ~/.bash_profile