Loading .bashrc on Mac OSX

Earlier this week, I went to setup aliases on Mac OS X (Mountain Lion) and couldn’t get the terminal to read the .bashrc file. It turns out that Mac OSX loads .bash_profile instead of .bashrc.

So I spent some time searching and found out that OSX will check a few files for additional shell config

~/.bash_profile, ~/.bash_login, and ~/.profile

Note: The files are also read in the order above. If you have a .profile file and a .bash_profile, the .profile config will be ignored.

I’m used to using .bashrc for everything so to get around my habit, I just added the following lines to .bash_profile.

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

Now, I just carry on like I always did!

I’m sure that the same .bashrc fix will apply to Lion and Snow Lepord as well.

Read More