SampleOSXLaunchDaemon
SampleOSXLaunchDaemon copied to clipboard
Managed (with difficulty) to build and run, but...
First, the "install" and "uninstall" targets are quite weird (they do their stuff at "build" time and not on "run" time - so on later Xcode versions, they simply fail immediately for not producing anything.
Second - you indeed said in ReadMe -
You will need to set SUDO_ASKPASS to run the installation and uninstallation targets.
but you didn't say where and to what --- I looked quite everywhere and didn't manage to find a way to make this work (I even saw your own setting somewhere in the project - assumed the value should be 'root' password and tried that too - to no avail.
So finally - only by doing both the "install" and "uninstall" stages manually in terminal (copying the .plist, the binary and then using launchctl to load the daemon) was I finally able to Mae things work. So -- this part needs some enhancement.
HOWEVER... I'm trying to use this wisdom and know-how in my own project, and simply cannot make it work.
I replicated almost exactly what you did, and my "Client" (some sample UI app I put up for this) cannot "talk" to the "XPC Service" (a global daemon I have). the lazily-initialised "connection" property always gets the "connection invalidated".
while my daemon's "listener" delegate (the one that should setup and approve a connection) simply never gets called.
Now... I wonder where I went wrong - and if there are specific "rules" you didn't write about ---
Mine is a global launch-daemon running with root privileges. its .plist is installed exactly the same place as yours, but the binary cannot reside in /Library/PrivilegedHelpers/ because it MUST be packaged within an App bundle, which is stored in /Library/xxxxx/myDaemon.app
I wonder if you can help with identifying the missing part/s so that when I get it to work - I will be able to contribute to this repo, by enhancing the documentation, or even brining in more content...
I will be more than happy to hear from you.