Starting with OS X Mavericks 10.9, an assistive application can use Accessibility features to explore, monitor and control the User Interface of another application only after access to the computer is enabled with an administrator password manually on a per-application basis. Prior to Mavericks, access could be enabled globally for all applications at once, and access could be granted programmatically. Go to PFiddlesoft Frameworks Support and read "A Note on Security Issues Presented by Assistive Applications" for more information about this significant security improvement introduced in Mavericks.
The AXIsProcessTrustedWithOptions() function was added to the Accessibility API in Mavericks to ease the burden of granting per-application access. It presents a standardized system-level modal alert inviting the user to open System Preferences. It takes the user to the Accessibility list in the Privacy tab of the Security & Privacy pane in System Preferences, where access to the computer using Accessibility features can be granted manually on a per-application basis. The user must first enter an administrative password to unlock the Privacy pane, and the user can then select a checkbox to grant the application access to the computer. The alert is provided by the system and it has some limitations. The assistive application has no control over its wording or the manner in which it is presented, and the assistive application receives no feedback regarding what the user did in System Preferences or when the user did it.
Accessibility Testbench demonstrates how an assistive application can present a custom alert in place of the built-in system-level modal alert. A custom alert has several advantages over the standard alert: It can be presented as a sheet instead of a freestanding modal alert. It is provided by the application instead of the system, and it therefore allows the application to work directly with the user's response. And it allows the use of different wording in the alert.
Accessibility Testbench also demonstrates how an assistive application can respond to the user's granting or denying access in System Preferences by observing the System Preferences "com.apple.accessibility.api" distributed notification.
Finally, Accessibility Testbench provides a useful Reset Access button to remove all applications from the Privacy pane's Accessibility list in Security & Privacy preferences, so developers can repeatedly test their applications' behavior as if it were being run for the first time.