Skip to content

Commit

Permalink
fix(sql): Use auth_value=2 when enabling on macOS 12+
Browse files Browse the repository at this point in the history
The script was setting auth_value to value `1` when enabling an application/client in the tccutil database.

According to #61, on macOS 12.4 and macOS 13.5 the correct value for enabling is `2`.

This commit adds a conditional value depending on OS version to use `auth_value=2` on macOS 12.0 and higher.

Issue: #61
  • Loading branch information
C-Duv authored and jacobsalmela committed Feb 26, 2024
1 parent b48d273 commit 512b611
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tccutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,9 @@ def enable(client):
# right away (without closing the window).
# Set to 1 to enable the client.
enable_mode_name = 'auth_value' if osx_version >= version('10.16') else 'allowed'
enable_value = '2' if osx_version >= version('12.0') else '1'
try:
c.execute(f"UPDATE access SET {enable_mode_name}='1' WHERE client='{client}' AND service IS '{service}'")
c.execute(f"UPDATE access SET {enable_mode_name}='{enable_value}' WHERE client='{client}' AND service IS '{service}'")
except sqlite3.OperationalError:
print("Attempting to write a readonly database. You probably need to disable SIP.", file=sys.stderr)
commit_changes()
Expand Down

0 comments on commit 512b611

Please sign in to comment.