Where macOS Stores Accessibility Preferences

macterminal

I want to check if a certain app is allowed to control my computer from the terminal. I need to check Privacy > accessibility settings to do that. How do I check– where are accessibility settings stored?

Best Answer

The database is located at /Library/Application Support/com.apple.TCC/TCC.db.

To query the database from the command line, use sqlite3.

  • You can query what access a certain app has.

    sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db \
      'select service from access where client like "com.apple.Terminal"
        and auth_value = 2;'
    
    kTCCServiceDeveloperTool
    kTCCServiceListenEvent
    kTCCServicePostEvent
    kTCCServiceScreenCapture
    kTCCServiceSystemPolicyAllFiles
    
  • You can query what apps have access to a certain permission like accessibility.

    sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db \
      'select client from access where service like "kTCCServiceAccessibility"
        and auth_value = 2;'
    
    com.apple.AEServer
    com.apple.MobileSMS
    com.apple.dt.Xcode-Helper
    …
    

To perform these queries, Terminal needs full disk access (kTCCServiceSystemPolicyAllFiles).

Replace auth_value = 2 with allowed = 1 if on an older macOS like High Sierra (not sure at which point it changed between High Sierra and Big Sur).