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


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:


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


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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