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

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
1  
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
    
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/. – LiberalArtist Jan 27 at 18:54

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.