Accessibility API access from a command line macOS client

I'm working on a command line tool that uses the Accessibility APIs on macOS. Running inside Xcode works fine, but directly from the command line I still get false from AXIsProcessTrustedWithOptions, even though the switch in System Settings is turned on.

The binary is signed with a Developer ID certificate.

What else should I look at to debug?

Does your command line tool have an embedded Info.plist? I would guess that Accessibility access is recorded by bundle ID.

Yes, it does. "Create Info.plist section in binary" is set to true. Same bundle ID when run inside Xcode or standalone.

in another Terminal window:

log stream --predicate '((process beginswith "tcc") and (message contains "<bundle ID of your tool>"))'

then run the tool, should give you some clues

Accessibility API access from a command line macOS client
 
 
Q