Mac OSX Not Sourcing .bashrc in Terminal
Posted
- February 11th, 2008
Comments
Tags
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.
October 13th, 2008 at 11:57 pm |
Can you spell out the steps for the Terminal scripting impaired? like where does this piece of code go?
Thanks
October 23rd, 2008 at 5:32 pm |
[...] 十月 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/ [...]
January 4th, 2010 at 6:18 pm |
put the if block that he gave you at the end of your ~/.profile