Running processes in OS X, Find the initiator process

103 Views Asked by At

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.

For instance, When I press an hyperlink from Microsoft Word that should open executable file like file:///Applications/Chess.app/

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.

Perhaps there's a mach_port (or any other) api to figure out who really initiated the application ?

1

There are 1 best solutions below

0
On BEST ANSWER

You can't. Mac OS X does not keep track of this information in the way you're looking for -- opening an application from another application does not establish a relationship of any sort between those applications.