What makes Catalina make a shell script quarantined

bashcatalinacommand line

I am routinely editing shell scripts (bash). One of them gets quarantined whenever I modify it. When I run it, I get the error:

$ ./opg.sh 
-bash: ./opg.sh: /bin/bash: bad interpreter: Operation not permitted

The solution is to reset the quarantine flag. Then the script runs:

$ xattr -d com.apple.quarantine opg.sh
$ ./opg.sh 
Missing or invalid option ...
Must be one of: start, stop, status, check, or log

My question: why is that ? I have tons of other bash scripts, in the same directory and in other directories. I can edit them and they do not get quarantined. Only this one does. Any idea why ?

It does not seem to be related to the editor I use (I use bbedit and textedit – same effect).

I guess it must be something to do with the content of the script. But I can't see what …

Best Answer

This can be fixed in BBEdit by doing this:

Check and see whether sandbox access is allowed (in BBEdit's "Application" preferences). If it is not, allow it and I think that will solve this for you.

Source: https://twitter.com/siegel/status/1161105160212484097