title: OS X - Determine the enviroment for a given PID?
body: <p>For a given process ID, what is the best/most direct way to determine the environment variables (e.g. PATH)?  Must be able to query for any arbitrary environment variable.  PATH is just the first example.</p>
  
  <pre><code>'lsof -a -p $PID -d cwd -F' gets some of it.  
  </code></pre>
  
  <p>But, I don't see a way to get the PATH for the given PID, using lsof.</p>
  
  <pre><code>'ps -Ep $PID' gets some of it.  
  </code></pre>
  
  <p>But, again, 'not comprehensive.  It appears to give back only a portion of the 'environment' for the process.</p>
  
  <p>On a number of other Linux/UNIX variants, you can look at '/proc//environ'.  But, OS X apparently does not use that mechanism.</p>