Apple - Allow application to control computer (assistive devices) on Mavericks via Terminal?
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,""
.
You can also add the file by following the commands below.
This command will find the Bundle Identifier for the application you are trying to add to Assistive Devices.
/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' /Applications/enterapplicaitonnamehere.app/Contents/Info.plist
Let's say the application you were trying to add was SKYPE. You would then enter this below:
/usr/libexec/PlistBuddy -c 'Print CFBundleIdentifier' /Applications/Skype.app/Contents/Info.plist
And your bundle identifier would be :
com.skype.skype
You then use this output in the command below:
sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "REPLACE INTO access VALUES('kTCCServiceAccessibility','',0,1,1,NULL);"
For Skype it would look like this:
sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "REPLACE INTO access VALUES('kTCCServiceAccessibility','com.skype.skype',0,1,1,NULL);"
To remove the application you would use the sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "delete from access where client='com.skype.skype';"