I am trying to insert a row into a system database in Mac, The TCC database. Mainly I am trying to insert into the 'access' table in this Database.
c.execute("INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','%s',%s,1,1,NULL,NULL)" % (client, client_type))
This works properly on most of the macs I have tested it on (I am writing code that should work on multiple macs). But there is this one mac in which when I run this command it comes back with
File "read.py", line 76, in insert_client
c.execute("INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','%s',%s,1,1,NULL,NULL)" % (client, client_type))
sqlite3.OperationalError: attempt to write a readonly database
What can I do to make sure it opens as a writable database.
NOTE: I read this question and its answer. So I figured I should change my permissions. The folder in which I have the .db file is /Library/Application \Support/com.apple.TCC/TCC.db
Now these are the following permissions for each of these folders
ls -lOe output
drwxr-xr-x+ 57 root wheel sunlnk 1938 Feb 17 17:39 Library 0: group:everyone deny delete
drwxr-xr-x 11 root admin sunlnk 374 Feb 21 09:50 Application Support
drwxr-xr-x@ 3 root wheel restricted 102 Feb 27 11:35 com.apple.TCC
-rw-r--r-- 1 root wheel restricted 57344 Feb 27 11:35 TCC.db
Now I try to chmod all of these to 775 but on each of them I get :Operation not Permitted.
What am I doing wrong? And is there another way to fix this?