title: Running processes in OS X, Find the initiator process
body: <p>I'd like to create a daemon (base on script or some lower level language) that calculates statistics on all opened applications according to their initiating process. The problem is that the initiating process does not always equivalent to the actual parent process.</p>
  
  <p>For instance, When I press an hyperlink from Microsoft Word that should open executable file like  <code>file:///Applications/Chess.app/</code></p>
  
  <p>In the case above, I've observed that the ppid of 'Chess' is in fact 'launchd', just the same as if I was running it from launchpad.</p>
  
  <p>Perhaps there's a mach_port (or any other) api to figure out who really initiated the application ?</p>