How to fix LaunchAgent scandir: [Errno 1] Operation not permitted error? &lt;key&gt;ProgramArguments&lt;/key&gt;
&lt;array&gt;
  &lt;string&gt;/usr/local/bin/backup.sh&lt;/string&gt;
&lt;/array&gt;

Running /usr/local/bin/backup.sh requires access to ~/Documents.
My gut feeling is I have to allow an app in &quot;Security &amp; Privacy&quot;, but which one and is that secure?
The following worked!
I created an app using &quot;Script Editor&quot; that runs /usr/local/bin/borg-backup.sh using zsh.
do shell script &quot;zsh /usr/local/bin/borg-backup.sh&quot;

I then exported the app to /Applications/borg-backup.app clicking &quot;File&quot; then &quot;Export...&quot; choosing &quot;Application&quot; for &quot;File Format&quot;.
Finally, I updated ~/Library/LaunchAgents/local.borg-backup.plist.
&lt;key&gt;ProgramArguments&lt;/key&gt;
&lt;array&gt;
  &lt;string&gt;open&lt;/string&gt;
  &lt;string&gt;/Applications/borg-backup.app&lt;/string&gt;
&lt;/array&gt;

The first time the launch agent ran, a prompt asked me to grant borg-backup.app access to ~/Documents.