Sign up ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
Related: Find out where $PATH is defined – Dennis Jul 17 '12 at 4:32

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
Nothing happens. What is supposed to happen? – JohnyTex Sep 3 '14 at 12:32

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).

share|improve this answer

Your Answer


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.