"is not allowed for assistive access" error when running AppleScript from Java "is not allowed for assistive access" error when running AppleScript from Java jenkins jenkins

"is not allowed for assistive access" error when running AppleScript from Java


I think you answer your own question. You can allow assistive access for Script Editor (among other things). It works fine in Script Editor.

You can try and add other applications to have assistive access. This might be an option if Script Editor does not give you want you want.

enter image description here


I've resolved something like this problem before by inserting osascript into the TCC.db using tccutil.py

After installing I linked tccutil.py into the path.

sudo ln -s /source/tccutil/tccutil.py /usr/bin/tccutil.py ls -l /usr/bin/tccutil.py lrwxr-xr-x  1 root  wheel  26 30 Dec 14:57 /usr/bin/tccutil.py -> /source/tccutil/tccutil.py

Then to allow osascript access to control your computer use the following compand

sudo tccutil.py --insert /usr/bin/osascript

I even added the script when the problem happened again later on.

sudo tccutil.py --insert $(pwd)/transcribe-audio-to-text.js

That failed so I rebooted which worked :-)

transcribe-audio-to-text.js currently uses System Events to make TextEdit be able to save a text file. It's part of virtual assistant which is very alpha at 20160105 but the source is interesting. virtual-assistant


I find that I sometimes need to add the parent of the process that calls osascript, in addition to osascript itself, regardless of what the error message says. Sometimes I have to add the grandparent process too.

In particular, /bin/bash does not call any assistive API, but OSX wants it listed even though osascript is also listed, and I've had to add TeamCity's agent.jar too.

So try adding your .jar file, and look to see whether ScriptEngine uses an intermediate code executor that you'll also need to enable.

Beware that you'll probably have to remove and add your entries if you change the binary (I think OSX maintains some sort of checksum in the final binary entry in its database entry).