Sunday, January 29, 2012

mac lion terminal doesn't source profile

I have encountered the problem that my MacBook Pro ~/.profile doesn't been sourced in the terminal.

The solution is simple:
bash first runs /etc/profile. /etc/profile (on Mac OS X 10.6.7) runs path_helper(8) which is where your default paths get set. After that it runs /etc/bashrc which doesn't do much. Once the default configuration is set, it moves on to the user login scripts.

bash looks in your home directory for .bash_profile, .bash_login, and .profile in that order. bash will run the first of these that it finds and stop looking.

So, if you have a .bash_profile in the home directory, the .profile will be ignored. In this case, just append a line in .bash_profile:

$cat "source ~/.profile" >> .bash_profile

No comments:

Post a Comment