I have a cocoa app that needs to get a list of processes. After enabling app sandboxing, I get /bin/ps: Operation not permitted
. Is there another way of doing this that's compatible with app sandboxing? I am running this via NSTask
Asked
Active
Viewed 516 times
1

denniss
- 17,229
- 26
- 92
- 141
-
That's why sandboxing is one of the most stupidest ideas on desktop computers since the late 40's. – Julian F. Weinert Jul 26 '16 at 03:08
-
Which attributes of the processes are you interested in? – mahal tertin Jul 28 '16 at 14:17
-
@mahaltertin the path – denniss Jul 28 '16 at 17:21
2 Answers
1
You can't run ps
from the sandbox, because it is a set-uid root program.
There is no other documented way to get a process list. There is, however, an undocumented API described in libproc.h
. I'm not sure if you can use it from the sandbox, but it's worth a try.

tbodt
- 16,609
- 6
- 58
- 83
1
You can use [[NSWorkspace sharedWorkspace] runningApplications] to get a list of all processes. This will return an array of NSRunningApplications.
https://developer.apple.com/reference/appkit/nsworkspace https://developer.apple.com/reference/appkit/nsworkspace/1534059-runningapplications https://developer.apple.com/reference/appkit/nsrunningapplication

mahal tertin
- 3,239
- 24
- 41
-
that does not return a list of all processes. just a list of user processes. – denniss Jul 28 '16 at 17:20