zsh: permission denied when Terminal has Full Disk Access
I regularly use shell files to execute tasks on my Mac quicker.
I just upgraded to MacOS Monterey today, and since then, any shell files I have created, will not execute. Every time I double click on their icon, I get
zsh: operation not permitted
.
I have given the files proper executable permissions with
chmod +x my-file.sh
and
chmod a+x my-file.sh
and
chmod u+x my-file.sh
,
but none of those work. Shell files I have created in the past still work fine, but it is just new ones that do not.
Terminal has full disk access in System Preferences.
I am stuck, and I don't know what to do, because I use shell files regularly. If anybody has any idea what's going on, any help would be appreciated.
This occurs because of Apple Quarantine:
You can run this:
xattr -d com.apple.quarantine /PATH/TO/SCRIPTYOUCANTRUN.sh
See more here: https://www.alansiu.net/2021/08/19/troubleshooting-zsh-operation-not-permitted/