The problem
macOS asks for permission if an app wants to access e.g. Calendar.app.
Unfortunately it asks only one time, i.e. if one doesn’t click the right button it will never ask again.
Writing a new extension whose AppleScript needs to access Calendar.app I didn’t get a permissions dialog (I guess I denied access to Calendar in the past, but really no idea how that could have happened as I don’t have an extension that needs access to it).
Resetting macOS permissions database
Even after resetting the permissions database with
sudo tccutil reset Calendar
and
tccutil reset All com.pilotmoon.popclip
and restarting I couldn’t make macOS ask again. Checking System Preferences I could tell that the tccutil commands did work, i.e. after using them Calendar was empty and PopClip was removed from Automation. But still no permissions dialog.
The solution
Short before giving up I tried this:
- Create a shell script (extension
.sh) that runs the AppleScript viaosascript
osascript -e 'set theDate_AppleScript to current date
tell application "Calendar"
view calendar at theDate_AppleScript
end tell'
-
In the
config.plist- change the
AppleScript Filekey toShell Script File - change the key’s value to the shell script’s name
- change the
-
Use extension
YES!
This triggered a dialog asking for permission to access Calendar!
YES! YES! YES!
