2

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?

1 Answer 1

2

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.

You must log in to answer this question.

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