There are some paths in $PATH, which I don't want. I'm not sure how they got there; they aren't coming from my .profile
. Is there a way to determine which scripts are modifying $PATH?
2 Answers
The very first file to processed is /etc/profile
. At the beginning of this file, add the line
set -x
then open a new terminal window. You will get more output than you wanted, but it will be a trace of all the bash code that is executed from your startup scripts.
-
2
In OS X, default paths are set in /etc/paths
, and possibly in the sub-files (if any) of /etc/paths.d/
. See also path_helper(8)
.
-
The accepted answer (about
set x
) did give me "all the bash code that [was] executed from [my] startup scripts," but it didn't tell me which startup script executed each bit of code. The incorrect behavior I was looking for was caused by a file in/etc/paths.d/
. Jan 27, 2016 at 18:54