Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.