Search code examples
cocoamacosunixmacos-carbon

Programmatically check if a process is running on Mac


Is there any Carbon/Cocoa/C API available on Macs that I can use to enumerate processes? I'm looking for something like EnumProcesses on Windows.

My goal is to check from code whether a process is running (by name).

Thanks!


Solution

  • TechZen says: The Process Manager is, as of Dec 2013, completely deprecated.

    Ah, I just found the Process Manager reference

    Looks like GetNextProcess and GetProcessInfo help in figuring out what's running. As suggested by Dave, GetBSDProcessList can be used if you're looking for daemons and not just Carbon/Cocoa processes.