[TCC]ユーザーTCC.dbの値の操作(リセット)
/usr/bin/tccutil reset は値が削除されるわけではない
『次回』アクセス時に値をセットする…そんな感じの動作です
sqlで値を『置き換え』する前に必要です
ダウンロード - usertccreset.scpt.zip
値を削除する場合はこちら
[TCC]ユーザーTCC.dbの値の操作(削除)
https://quicktimer.cocolog-nifty.com/icefloe/2022/03/post-46638b.html
#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#選択したアプリケーションの
#ユーザーTCCdbをリセットします
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
set aliasFile to (choose file with prompt "アプリケーションを選択してください" default location (path to applications folder from user domain) of type {"com.apple.application-bundle"} with invisibles without multiple selections allowed and showing package contents) as alias
tell application "Finder"
set objInfo to info for aliasFile
set strUTI to bundle identifier of objInfo
end tell
set aliasHOME to (path to home folder from user domain) as alias
set strHOME to POSIX path of aliasHOME as text
set strUserTCC to "" & strHOME & "/Library/Application Support/com.apple.TCC/TCC.db" as text
set listUserTCCcolumn to {"kTCCServiceSystemPolicyDocumentsFolder", "kTCCServiceSystemPolicyDownloadsFolder", "kTCCServiceSystemPolicyDesktopFolder", "kTCCServiceSystemPolicyNetworkVolumes", "kTCCServiceSystemPolicyRemovableVolumes", "kTCCServiceFileProviderDomain", "kTCCServiceMediaLibrary", "kTCCServicePhotosAdd", "kTCCServicePhotos", "kTCCServiceAppleEvents", "kTCCServiceFocusStatus", "kTCCServiceUserAvailability", "kTCCServiceListenEvent", "kTCCServiceSpeechRecognition", "kTCCServiceBluetoothAlways", "kTCCServiceCamera", "kTCCServiceUbiquity", "kTCCServiceLiverpool", "kTCCServiceReminders", "kTCCServiceCalendar", "kTCCServiceAddressBook", "kTCCServiceMicrophone"}
set numCntTCCcolumn to (count of listUserTCCcolumn) as number
repeat with strUserTCCcolumnName in listUserTCCcolumn
set strTccutilResetName to doReplace(strUserTCCcolumnName, "kTCCService", "")
set strCommandText to "/usr/bin/tccutil reset " & strTccutilResetName & " " & strUTI & ""
do shell script strCommandText
end repeat
to doReplace(theText, orgStr, newStr)
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to orgStr
set tmpList to every text item of theText
set AppleScript's text item delimiters to newStr
set tmpStr to tmpList as text
set AppleScript's text item delimiters to oldDelim
return tmpStr
end doReplace
| 固定リンク
「TCC」カテゴリの記事
- [TCC]サービス名を指定してTCCをリセットする(2023.06.05)
- [TCC]位置情報 locationd とLiverpoolからアプリケーションを指定して削除(2023.06.05)
- [sqlite3]モード (output mode)その1 ファイルに書き出す(2023.06.01)
- [sqlite3]モード (output mode)その2(2023.06.01)
- [TCC]kTCCService(OS13.4)(2023.06.01)