Using AppleScript :
tell application "System Events"
tell security preferences
set properties to {require password to unlock:true}
end tell
end tell
You can call the Applescript code using the osascript
command.
To remove all apps from a particular Privacy category, open Terminal.app and type the following command, then type the Return key:
tccutil reset CATEGORY
where CATEGORY is one of:
- Accessibility
- AddressBook
- AppleEvents (i.e. Automation)
- Calendar
- Camera
- Microphone
- Photos
- Reminders
- ScreenCapture (for the Screen Recording list)
- SystemPolicyAllFiles (for the Full Disk Access list)
- SystemPolicyDesktopFolder
- SystemPolicyDeveloperFiles
- SystemPolicyDocumentsFolder
- SystemPolicyDownloadsFolder
- SystemPolicyNetworkVolumes
- SystemPolicyRemovableVolumes
- SystemPolicySysAdminFiles
If you want to remove only a particular app, you need to first determine its Bundle ID. Once you know that, issue the command:
tccutil reset CATEGORY BUNDLEID
Note: Specifying an app's Bundle ID appears to require macOS Mojave (10.14) or later.
You could also remove all apps from all categories:
tccutil reset All
Though this might freeze your Mac on macOS 10.15 and later, see comment below.
In the example given in the question, the following commands would remove Terminal and Chrome from Calendars.
First, determine their Bundle IDs:
osascript -e 'id of app "Terminal"'
shows com.apple.Terminal
. Same for "Chrome" gives: com.google.Chrome
. Now we can reset them:
tccutil reset Calendars com.apple.Terminal
tccutil reset Calendars com.google.Chrome
Pro tip:
This is a one-liner doing the same:
tccutil reset Calendars `osascript -e 'id of app "Chrome"'`
More info in this blog article: Managing Mojave’s privacy protection: Privacy controls.
Best Answer
Try Apple's command line tool
tccutil
! The general usage is:Only one command (
reset
) is implemented right now. The service is the protected item (e.g. Microphone or Photos). The bundleIdentifier is the bundle identifier of the app given access to protected services.Get the bundleIdentifier of the apps to remove:
Real example:
More methods to get the bundleIdentifier: Getting the bundle identifier of an OS X application in a shell script. The app to remove is not necessarily in /Applications or /Applications/Utilities/.
Remove all permissions for the app:
RansomWhere?'s exec has a (null) bundleIdentifier. The associated launch daemon plist contains a
com.objective-see.ransomwhere
though, which looks like a typical bundleIdentifier. I would try this one first.BTW: RansomWhere? is no ransomware but a sec tool available here: RansomWhere?
Alternative approach:
Download tccutil (v1.2.5) from github. It's not related to Apple's command line tool though having the same name. It's also available via brew but apparently outdated there (v1.2.2) and won't work with Catalina.
In the command line enter (in the example below I d/led the zip to Downloads and unzipped it there - apply the path below to your environment respectively):
-h to get a short help text
-l to list all items in the accessibility database
-r to remove an app/entry