I have used NSApplication and NSWorkspace to get a list of running applications.
But it is only giving me the applications that are active from the administrator and not the root processes that run in the background.
I want to get a list of all running processes and keep updating that list as soon as a new process spawns.
I prefer not to use NSTask
and parsing the output.
Is there a fix for this?
NSArray * runningapps = [[NSWorkspace sharedWorkspace] runningApplications];
Refer to the website given below : https://github.com/objective-see/ProcInfo
To have access to the list of root processes you need to do stuff very similar to what the ps
command does. If you want to go at it, go study the source code of this tool:
https://opensource.apple.com/source/adv_cmds/adv_cmds-172/ps/
However, as you can see, this is not easy. Thus, if you don't want to reinvent the wheel, I'd just parse the output of ps
command with grep
or you will need to write your own code to do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With