I’m not sure what you’re asking here:
The answer to the first is… well… sheesh… I have no idea, but it seems like a bad idea. SMAppService
is intended to be used by apps; it’s right there in the name.
The answer to the second is simply “Yes.”
Also, is it possible to launch the SMAppService.daemon
without the XPC connection?
Once you install a daemon using SMAppService
, it’s like any other launchd
daemon. You can use the MachServices
property to have it launch on demand in response to XPC messages. However, that’s not required. It can, for example, use the Sockets
property to listen on a TCP or Unix domain socket.
The daemon currently supports grpc. I was thinking about
running it via Process
?
Hmmm, I think we’re using a different definition of daemon. On macOS a daemon is a process that runs in the global context, typically as root. See Technote 2083 Daemons and Agents.
If your app spawns a child process using Process
, it can’t be a daemon because it’s running in the GUI login context of the user who ran your app.
So, taking a step back, what characteristics are you expecting from this process:
-
Do you need it to run as root? Or, equivalently, as some role account user that’s not the same as the user who ran your app?
-
What lifecycle are you looking for? Should it stop when your app quits? Or run for while this user is logged in? Or run forever, even if no user is logged in?
-
Is your app sandboxed?
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"