views:

231

answers:

3

How can I get a list of the names of all currently running processes? (In C/Objective-C on Mac OS X.)

A: 

I know you can do this on unix like systems. In the directory /proc are directories which stand for every process. In those directories you have a file called cmdline which hold the command line who started this process.

I don't know if this is the same on Mac OS X, but you can go further with that.

VDVLeon
/proc is a Linux idiom and not available on OS X.
jon hohle
jon hohle: Very true, but I think you meant "an **awesome** Linux idiom".
Jason Orendorff
A: 

A simple google search yielded the following result for me :

http://jongampark.wordpress.com/2008/01/26/a-simple-objectie-c-class-for-checking-if-a-specific-process-is-running/

Notice this goes even further and adds a function to search for a running process.

Amir Afghani
+3  A: 

Cocoa processes can be retrived from NSWorkspace [[NSWorkspace sharedWorkspace] runningApplications]

For the entire process list (i.e. including non graphical) see Technical Q&A QA1123

diciu
thx a lot. Exactly what I was looking for!
V1ru8