I'm developing an Accessibility-enabled app that includes a helper app registered as a launch daemon using SMAppService. This daemon will connect to HID which requires both being root as well as having Accessibility (or Input Monitoring) permissions. I want this app to have as little friction for the user as I can manage.
One friction I'd like to avoid is requiring the user to grant more than one application permission to use Accessibility features. So I'm wondering if I can set up the launch daemon so that it inherits the TCC permissions of its parent bundle.
I'll note that the one way I've found that works is to not have the helper app have its own app bundle, but rather just have it be an executable placed alongside the main executable in enclosing bundle's Contents/MacOS directory. This has the disadvantage though of having the helper process and main process have the same name in Activity Monitor, which I think will be confusing to users.
So in short, is there a supported way for a bundled application with its own CFBundleName / CFBundleDisplayName key to run as a launch daemon and also inherit Accessibility permissions from its parent app bundle?
In general it’s not possible for a daemon to inherit its container app’s TCC privileges because of the potential for a difference in scope. Some TCC privileges are per user, so the fact that one user granted the privilege to the container app should not grant the privilege to a daemon, which is by definition system-wide.
Now, IIRC Accessibility is a system-wide privilege, and thus this could be made to work. However, it sounds like it doesn’t, which isn’t surprising. My experience is that TCC’s ability to trace from a daemon to its container app is rather limited, even if the daemon is installed via SMAppService, meaning that the OS in general knows where it came from.
the one way I've found that works is to not have the helper app have its own app bundle, but rather just have it be an executable placed alongside the main executable in enclosing bundle's Contents/MacOS directory.
Interesting. I’m surprised that works.
Regardless, I think you have a trade-off to make here:
- You can use this technique, which makes it easier for the user to grant the Accessibility privilege but could cause confusion in Activity Monitor and so on.
- You can put your daemon in an app-like wrapper, which will give you the result you want in Activity Monitor but makes it harder for the user to enable Accessibility.
Regardless of what you choose, I think it makes sense for you to file a bug requesting that we add better support for this.
Please post your bug number, just for the record.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"