Any way to "allow app to use accessibility" programmatically?


My OF app running on OSX 10.10 requires the user to allow it access to control the computer in System Preferences > Security & Privacy > Accessibility. For some reason, even if I allow it access by check its name in this window, after running the app once, the setting unchecks itself.

Is there a way to enable accessibility access programmatically? I looked into NSAccessibility with Cocoa, but it’s hard for me to understand what to do without an example.



For anyone wondering about this, it helps to change your app’s bundle identifier to something other than cc.openFrameworks.ofapp. After I did this, I was able to drag the app to “allow the apps below to control your computer” in System Preferences > Security & Privacy > Privacy > Accessibility.