Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On a mac when I open a terminal my PATH is:

/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Which includes some folders where mac port tools reside, but as soon as I create a ~/.bash_profile (even if it is blank) when I open a new terminal my PATH becomes:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

Why does the existence of ~/.bash_profile alter my PATH?

share|improve this question
up vote 2 down vote accepted

From the INVOCATION section of the bash man page:

   When  bash is invoked as an interactive login shell, or as a non-inter-
   active shell with the --login option, it first reads and executes  com-
   mands  from  the file /etc/profile, if that file exists.  After reading
   that file, it looks for ~/.bash_profile, ~/.bash_login, and ~/.profile,
   in  that order, and reads and executes commands from the first one that
   exists and is readable.  The --noprofile option may be  used  when  the
   shell is started to inhibit this behavior.

So those other PATH entries are probably from one of those other profile files.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .