11

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.

2
  • 4
    Can't reproduce the error. Are you sure you didn't create new files from another user? Maybe you accidentally ran sudo su before creating new files. What does ls -la say? Check the privileges and file owners. Where do you store your files?
    – Gintaras
    Commented Oct 30, 2021 at 1:28
  • Welcome to Ask Different. Can you run the scripts from Terminal with /path/to/my-file.sh or you also get an operation not permitted error?
    – jaume
    Commented Oct 30, 2021 at 17:38

1 Answer 1

18

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/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .