I recently got a new MacBook Pro and am finally starting to get the hang of it.  One of the irksome things I noticed was that in terminal, my .bashrc file wasn’t getting sourced initially.  I could source it myself, but that seemed a bit ridiculous.

The reason this was happening is that bash in terminal was looking in the .profile file, not .bashrc.  The simple fix here is to tell bash to look for .bashrc when it looks through .profile.  Here’s the simple bit of code to do this:

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

If you’d like a little more information about what you can do with .bashrc, take a look at this post I did a while back about my .bashrc file that I use.

3 Responses to “Mac OSX Not Sourcing .bashrc in Terminal”

  1. MC Lepus Says:

    Can you spell out the steps for the Terminal scripting impaired? like where does this piece of code go?

    Thanks

  2. Mac OSX Not Sourcing .bashrc in Terminal « constructive procrastination Says:

    […] 十月 23, 2008 Mac OSX Not Sourcing .bashrc in Terminal Posted by barleytea under Uncategorized | 标签: mac |   http://17thdegree.com/archives/2008/02/11/mac-osx-not-sourcing-bashrc-in-terminal/ […]

  3. will Says:

    put the if block that he gave you at the end of your ~/.profile

Drop Some Knowledge On Us…