WIth macOS 27.3 (beta 2) things have changed quite a bit for security, see Updates to Device Control and Data Access, and Full Disk Access in macOS
I have an app which uses what (used to be called) the Privacy & Security / Accessibility permissions in order to receive mouse events in the background to read them and occasionally modify them.
The method used:
- The app checks AXIsProcessTrustedWithOptions to see if it has permission.
- If it doesn't have permission, it uses the kAXTrustedCheckOptionPrompt option which would open up the privacy & Security / Accessibility pane.
- Because that process has been a little flakey in macOS, my app has a backup option, where it runs 'open "x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension?Privacy_Accessibility"' and then walks the user through the steps with onscreen instructions.
- When permission is granted, the app creates a CGEvent tap SessionEvent tap using the HeadInsertEvent option to receive mouse and touch mouse events. See CGEvent.tapCreate
In macOS 27.3 beta 2,
- always returns false
- using kAXTrustedCheckOptionPrompt fails to do anything
- open "x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension?Privacy_Accessibility fails to do anything.
- CGEvent tap fails
A few questions:
- will my third party app be allowed to use CGEventTaps to read mouse and touchpad events? Or has this been cut off completely and only available to first party apps?
- If it is allowed, how? Has the permission for this moved to a different System Preference pane?
- is a CGEvent tap the way to do it?
I totally understand that security is important, and apps should not have wide-ranging permissions. I'd love to find a way to keep my app running with the minimal permissions needed.