I'm building an app for 10.8+ which among other things has to patch files. Because of this functionality I have created a "PrivilegedHelperTool" and installed as KeepLive = YES RunAtLoad = YES (so it's always running). I also use XPC over mach for communication to a GUI app (menubar)
I'd like to be able to check if the "PrivilegedHelperTool" is installed, and running and so far the best way to check installation i've found is look for the plist in /Library/LaunchDaemons/ and check the binary is in /Library/PrivilegedHelperTools .
Is this really the best way?
Also I have found no reliable way to check if the PrivilegedHelperTool(running as root) without already being root (eg. sudo launchctl list)
I added a wrapper which uses launch.h (/usr/include/launch.h) http://brockerhoff.net/blog/2009/02/02/cocoa-musings-pt-3/ but it only returns user processes and getting the end user to escalate privileges just to check some "plugin" is running seems wrong.
Is it true that the best I can hope for is trying to talk to my service and if its not responding assume it's "damaged or not running"? ( http://mac-os-forge.2317878.n4.nabble.com/Programmatic-interface-to-launchctl-and-some-other-questions-OS-X-10-5-tp189494p189496.html )