Allow application to control computer (assistive devices) on Mavericks via Terminal? I'm currently working on automated instalation of Mavericks 10.9. I have NetBoot set up. Everything works OK untill I want to execute Applescript. Since the release of new version I need to manually enable those scripts. Is there a command that I can use in shell script to add app to Assistive Devices list? Or maybe there is some plist that has to be edited for it to work?
The settings are stored in /Library/Application Support/com.apple.TCC/TCC.db:

$ sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db 'select * from access'
kTCCServiceAccessibility|com.apple.ScriptEditor2|0|1|0|��

kTCCServiceAccessibility|com.red-sweater.FastScripts|0|1|0|��

kTCCServiceAccessibility|com.apple.AccessibilityInspector|0|1|0|��

kTCCServiceAccessibility|com.slate.Slate|0|1|0|��

kTCCServiceAccessibility|com.apple.Automator|0|1|1|
kTCCServiceAccessibility|com.googlecode.iterm2|0|1|1|


The schema, as given by sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db '.schema access', is:

CREATE TABLE access (service TEXT NOT NULL, client TEXT NOT NULL, client_type INTEGER NOT NULL, allowed INTEGER NOT NULL, prompt_count INTEGER NOT NULL, csreq BLOB, CONSTRAINT key PRIMARY KEY (service, client, client_type));


On my installation the last four columns (client_type, allowed, prompt_count, and csreq) are 0|1|0|\xfa\xde\x0c for applications that were added after the "example.app" would like to control this computer using accessibility features dialog was shown and 0|1|1| for applications that I added by dropping them to the list in System Preferences.

~/Library/Preferences/com.apple.universalaccessAuthWarning.plist contains a list of applications for which the warning dialog has been shown:

$ defaults read com.apple.universalaccessAuthWarning
{
    "/Applications/Automator.app" = 1;
    "/Applications/Automator.app/Contents/MacOS/Automator" = 1;
    "/Applications/FastScripts.app" = 1;
    "/Applications/FastScripts.app/Contents/MacOS/FastScripts" = 1;
    "/Applications/Slate.app" = 1;
    "/Applications/Slate.app/Contents/MacOS/Slate" = 1;
    "/Applications/Utilities/AppleScript Editor.app" = 1;
    "/Applications/Utilities/AppleScript Editor.app/Contents/MacOS/AppleScript Editor" = 1;
    "/Applications/Xcode.app/Contents/Applications/Accessibility Inspector.app" = 1;
    "/Applications/Xcode.app/Contents/Applications/Accessibility Inspector.app/Contents/MacOS/Accessibility Inspector" = 1;
    "/Applications/iTerm.app" = 1;
    "/Applications/iTerm.app/Contents/MacOS/iTerm" = 1;
    "/Users/lauri/Desktop/aa.app" = 1;
    "/Users/lauri/Desktop/aa.app/Contents/MacOS/applet" = 1;
    "com.apple.AccessibilityInspector" = 1;
    "com.apple.Automator" = 1;
    "com.apple.ScriptEditor.id.aa" = 1;
    "com.apple.ScriptEditor2" = 1;
    "com.red-sweater.FastScripts" = 1;
    "com.slate.Slate" = 1;
}    


I couldn't figure out how to actually allow access for assistive devices for an application though. I tried for example running these commands:

sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db 'insert into access values ("kTCCServiceAccessibility","com.apple.ScriptEditor.id.qq",0,1,0,"'$'\xfa\xde\x0c''");'
defaults write com.apple.universalaccessAuthWarning com.apple.ScriptEditor.id.qq -bool true
defaults write com.apple.universalaccessAuthWarning /Users/lauri/Desktop/qq.app -bool true
defaults write com.apple.universalaccessAuthWarning /Users/lauri/Desktop/qq.app/Contents/MacOS/applet -bool true
sudo killall tccd


I also tried restarting to apply the changes and setting the last four columns to 0,1,1,"".