Programmatically check if a process is running on Mac

前端 未结 6 1386
伪装坚强ぢ
伪装坚强ぢ 2020-12-01 02:06

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 go

6条回答
  •  醉酒成梦
    2020-12-01 02:54

    In the overview of the NSRunningApplicationClass, it says:

    NSRunningApplication is a class to manipulate and provide information for a single instance of an application. Only user applications are tracked; this does not provide information about every process on the system.

    and

    To access the list of all running applications, use the runningApplications method in NSWorkspace.

    I would suggest taking a look at Workspace Services Programming Topics

提交回复
热议问题