GDBus should support launchd client-side
According to https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/179, GDBus clients cannot connect successfully to a typically-configured dbus-daemon on macOS. I'm forwarding this from dbus and I don't intend to work on it myself, but I can probably help with review, time permitting.
The launchd transport for client-side connections is briefly described in the D-Bus Specification, and seems to be fairly simple:
- Addresses take the form
- (Optional) Clients that were directly or indirectly started by launchd can look at their own
FOOenvironment variable. (libdbus doesn't actually do this.)
- Or, any client can execute a subprocess
launchctl getenv FOO, read its stdout until EOF, and remove the trailing newline. If the result is empty, fail (decline to connect, try the next transport if any). If non-empty, treat it as the absolute path of a Unix socket: for example if
launchctl getenv FOOprints
/foo\n, that should be treated as similar to
- The environment variable is typically
launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET;autolaunch:would be a sensible default for the session bus' connectable address on macOS (the same way we use
autolaunch:on other Unixes); or it could be treated as a special case, like the way we handle
The server-side protocol is a bit more complicated: it's like a more elaborate version of systemd socket activation (
systemd:), and I suspect we wouldn't want to support it in GDBus.