[HowTo] Mac 10.9 Mavericks: allow Sikuli to use assistive device support

Created by RaiMan on on 2013-11-16
Last updated by:
RaiMan on on 2014-07-13

For a few features Sikuli needs access to the assistive device support on Mac.
These are:
new App("some_app“).window()
new App("some_app“).window(n)

Until OSX 10.8 it was sufficient to just enable one global option in the SystemPreferences.

With OSX 10.9 Mavericks this is changed to a per-app concept
(a global option does not exist any longer).

And the handling of this option has moved to another place:
SystemPreferences -> Security & Privacy -> tab Privacy
... and currently it is not possible to add allowed apps in advance.

-- This is the workflow:
The first time an app requests access to the assistive devices, you are asked to allow it or not and the app is registered in the above Privacy tab.

I found, that with Sikuli, the above popup does not come in any case, but instead, the app is registered silently, but not activated.
So you have to go to the Privacy tab and activate the app, before access is granted.

When you run the app using Sikuli stuff using the above Sikuli features and the access is not yet granted, then you will get the Sikuli message, that assistive device support has to be switched on. The offer to do this for you answer with a NO, since the actions behind YES will not work on Mavericks. (your stuff might crash after that - ignore that for now)
Then check, wether your app is now in the Privacy tab (should be) and switch it on.
From now on your app should work.

*** These apps might need to be registered:
Sikuli-IDE.app (this is for up to RC3)
SikuliX-IDE.app (this is beginning with version 1.0.0)
NetBeans, Eclipse, ... any IDE, that is used to run Sikuli stuff
Terminal (for all situations, where you run something with Sikuli from a command line)

*** To force the registration simply run this one liner:

-- for some applications (e.g. Eclipse) a concrete version has to be registered. So after upgrading those applications, it might be necessary, to register again (delete the current entry before - see below)
-- and there might be cases, where not the expected app/executable but a parent process has to be given the access rights

*** Get rid of an app entry in the list:
if for any reason, you want to get rid of an app entry in the above list, run from terminal:
sudo sqlite3 /Library/Application\ Support/com.apple.TCC/Tcc.db 'delete from access where client like "%significant part of your app name%"'
e.g. to remove SikuliX-IDE.app, set significant part of your app name as SikuliX and keep the % in place.
(found here: https://discussions.apple.com/message/23654558#23654558)