Rebuilding the app does change the signature, and therefore needs to be trusted again.
Don't wanna manually trust the app each time.
I'd like to automate the process in development.
#!/usr/bin/env bash
set -eu
set -o pipefail
BUNDLE_ID='com.creasty.keyboard-dev'
DB="$HOME/Library/Application Support/com.apple.TCC/TCC.db"
DB="/Library/Application Support/com.apple.TCC/TCC.db"
# CREATE TABLE IF NOT EXISTS "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,
# policy_id INTEGER,
# indirect_object_identifier_type INTEGER,
# indirect_object_identifier TEXT DEFAULT 'UNUSED',
# indirect_object_code_identity BLOB,
# flags INTEGER,
# last_modified INTEGER NOT NULL DEFAULT (CAST(strftime('%s', 'now') AS INTEGER)),
# PRIMARY KEY (service, client, client_type, indirect_object_identifier),
# FOREIGN KEY (policy_id) REFERENCES policies(id) ON DELETE CASCADE ON UPDATE CASCADE
# );
sqlite3 "$DB" '.schema access'
sqlite3 "$DB" -header -column "select * from access where client = '$BUNDLE_ID';"
cat << SQL | sqlite3 "$DB"
insert or replace into access(
service,
client,
client_type,
allowed,
prompt_count,
csreq,
policy_id,
indirect_object_identifier_type,
indirect_object_identifier,
indirect_object_code_identity,
flags,
last_modified
) values (
'kTCCServicePostEvent', -- service,
'$BUNDLE_ID', -- client,
0, -- client_type,
1, -- allowed,
1, -- prompt_count,
NULL, -- csreq,
NULL, -- policy_id,
NULL, -- indirect_object_identifier_type,
'UNUSED', -- indirect_object_identifier,
NULL, -- indirect_object_code_identity,
0, -- flags,
cast(strftime('%s', 'now') as integer) -- last_modified
), (
'kTCCServiceAccessibility', -- service,
'$BUNDLE_ID', -- client,
0, -- client_type,
1, -- allowed,
1, -- prompt_count,
NULL, -- csreq,
NULL, -- policy_id,
NULL, -- indirect_object_identifier_type,
'UNUSED', -- indirect_object_identifier,
NULL, -- indirect_object_code_identity,
0, -- flags,
cast(strftime('%s', 'now') as integer) -- last_modified
);
SQL
sqlite3 "$DB" -header -column "select * from access where client = '$BUNDLE_ID';"