Run bash (.sh) via launchd using a plist in /Library/LaunchAgents
I have a .plist file located in /Library/LaunchAgents which properly references a script called "test.sh" located in ~/Documents/Scripts. I have also tried moving this script to ~/Library/Scripts and /Library/Scripts. The script is chmod +x and runs perfectly well from manual terminal session. I have also chown to root:wheel... nothing helps.
When the script is called by launchd via the plist, I get "Operation not allowed" error. This is written to stderr and in launchd.log
Similar is so easy on Linux. I am finding it impossible on macOS.
In systems settings, terminal has full disk access. Also, the script is auto added to Login Items and Extensions and this is set to enable.
Why is this sooo hard? All I want to do is run a script every hour from a background process. It all works but Mac refuses to run the actual script.
Thoughts?
MacBook Pro (M4 Pro, 2024)