The following worked!
I created an app using "Script Editor" that runs /usr/local/bin/borg-backup.sh
using zsh
.
do shell script "zsh /usr/local/bin/borg-backup.sh"
I then exported the app to /Applications/borg-backup.app
clicking "File" then "Export..." choosing "Application" for "File Format".
Finally, I updated ~/Library/LaunchAgents/local.borg-backup.plist
.
<key>ProgramArguments</key>
<array>
<string>open</string>
<string>/Applications/borg-backup.app</string>
</array>
The first time the launch agent ran, a prompt asked me to grant borg-backup.app
access to ~/Documents
.
launchd
is responsible for running of agents and daemons in the various locations they are stored. The user cannot selectively manually add programs to Files and Folders under System Preferences > Security & Privacy > Privacy, the system has to prompt the user for permission. However, the user can addlaunchd
to Full Disk Access. Don't know if this will solve your issue but it's a place to start. It might also be worth seeing the code in the shell script.launchctl
,launchd.plist
andlaunchd
. You can read the manual page forcommand
in Terminal by typingcommand
and then right-click on it and select: Open man Page