MacOS – Adding Apps to “Security & Privacy” Settings (Automatically)

automationmacosprivacySecuritysettings

I am looking for a way to automatically add applications to the "Location Services" and "Accessibility" (Mavericks only) lists in the "Security & Privacy" settings pane.

Optimally I could just change some file (eg plist) to add applications to these lists. If that's not possible, there's maybe some terminal and/or AppleScript way to achieve that?

Best Answer

Just found it. The settings are in one of these two files:

  • System-wide settings: /Library/Application Support/com.apple.TCC/TCC.db
  • Per user settings: ~/Library/Application Support/com.apple.TCC/TCC.db

They are SQLite databases of the following form:

sqlite> .schema access
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, CONSTRAINT key PRIMARY KEY (service, client, client_type));

Example (MS Office and Address Book setting):

sqlite> select * from access;
kTCCServiceAddressBook|com.microsoft.Word|0|1|0
kTCCServiceAddressBook|com.microsoft.Excel|0|1|0
kTCCServiceAddressBook|com.microsoft.Powerpoint|0|1|0

For other services, just pick the correct service name (such as kTCCServiceAccessibility) and the application bundle ID and add it to the appropriate database.