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,""
.
If you mount the hidden "Recovery HD" partition in Terminal:
sudo diskutil mount Recovery\ HD
and then again mount the "BaseSystem.dmg" by double clicking it:

then you should be able to use the setregproptool
, located inside "Firmware Password Utility.app":

To get to the folder containing setregproptool
right-click (or Control click) "Firmware Password Utility.app", select "Show Package Contents" and navigate to Contents/Resources.
Alternatively to the description in this link:
Set a firmware password from the command line - (see post from "Sep 13, '11 05:04:00AM ")
you can copy the "Firmware Password Utility.app" to a more acceptable location (for example on your local drive) and then use it from there.
These are the options of setregproptool
:
$ sudo Firmware\ Password\ Utility.app/Contents/Resources/setregproptool -h
Password:
setregproptool v 2.0 (9) Aug 24 2013
Copyright (C) 2001-2010 Apple Inc.
All Rights Reserved.
Usage: setregproptool [-c] [-d [-o <old password>]] [[-m <mode> -p <password>] -o <old password>]
-c Check whether password is enabled.
Sets return status of 0 if set, 1 otherwise.
-d Delete current password/mode.
Requires current password on some machines.
-p Set password.
Requires current password on some machines.
-m Set security mode.
Requires current password on some machines.
Mode can be either "full" or "command".
Full mode requires entry of the password on
every boot, command mode only requires entry
of the password if the boot picker is invoked
to select a different boot device.
When enabling the Firmware Password for the first
time, both the password and mode must be provided.
Once the firmware password has been enabled, providing
the mode or password alone will change that parameter
only.
-o Old password.
Only required on certain machines to disable
or change password or mode. Optional, if not
provided the tool will prompt for the password.
Best Answer
To set a default view style use:
with:
icnv: Icon View
Nlsv: List View
clmv: Column View
Flwv: Cover Flow View
To enable this immediately (which probably is not relevant for your shell script) you have to kill the Finder with
killall Finder
. Some folders might have a different view style set already (via .DS_Store files) while installation. You have to remove those invisible files to adapt your preferred style.To deal with the group/arrange/sort settings you have to use PlistBuddy and defaults. The relevant key/sub-keys are FXPreferredGroupBy and StandardViewSettings and therein IconViewSettings, ExtendedListViewSettings and ListViewSettings.
Examples:
Arrange by application:
Possible values for defaults are none, date, name, kind, Date Added, Date Created, Application etc.
Arrange by kind:
Sort by date added:
Possible values for PlistBuddy are none, date, name, kind, dateAdded, dateCreated etc.
Some combinations of those settings (view style, arrange by, sort by) aren't possible or don't make much sense (depending on your OS).