1

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 ...

5
  • If you think it‘s related to the content of the script, can you share the whole script? Also, which other attributes are set on the file?
    – nohillside
    Commented Jan 28, 2020 at 9:08
  • I just did the following: created a new file from scratch, copy and pasted the content of the previous script in the new file, saved it and renamed it to the same name as the original file. And it no longer gets quarantined. Commented Jan 28, 2020 at 9:14
  • So it looks like it is not something to do with the script content after all. Or the name of the file. I'm baffled. But at least I can keep on working normally. Commented Jan 28, 2020 at 9:15
  • Did the file originally start as a download? Or copied from something installed?
    – benwiggy
    Commented Jan 28, 2020 at 9:26
  • Not it was not a download. It is purely local - a script I wrote myself manually. Just like the others. Commented Jan 28, 2020 at 9:46

2 Answers 2

2

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

2

macOS will automatically quarantine executable files that are written by sandboxed applications, unless the file being written is within a directory for which the application has a "sandbox extension".

More on this is available here: https://www.barebones.com/support/bbedit/quarantine.html

You must log in to answer this question.

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