Quarantined Python files created/edited by BBEdit (High Sierra / Gatekeeper / com.apple.quarantine)

194 views
Skip to first unread message

David Stein

unread,
Dec 1, 2017, 5:22:41 PM12/1/17
to BBEdit Talk
All:

I'm a fairly new BBEdit user, having upgraded after years of good experiences with TextWrangler. (I encountered some bumps and bruises in the transition, but Patrick has been both very responsive and very helpful - kudos on providing great customer service!)

But I'm continuously running into an issue with High Sierra and Gatekeeper, which is part of MacOS's security and malware infrastructure.

The problem is that almost any .py file I create or edit with BBEdit gets instantly flagged by Gatekeeper as "an untrusted file from the internet," and it gets quarantined. The behavior is simple and reproducible - simply open or create a file with a .py extension, make some change, save it, and run it. In almost all cases, I get the response:

-bash: (filename).py: /usr/bin/env: bad interpreter: Operation not permitted

Fixing it is trivial, with the command:

xattr -d com.apple.quarantine (filename).py

...but the next time I edit the file with BBEdit and try to run it, the quarantine gets reapplied.

This behavior has a few quirks:

1) It *only* happens with BBEdit. No other apps on my machine cause this problem to occur. I don't know that BBEdit is *at fault* here - it seems much more likely a MacOS problem - just noting that the problem is specific to BBEdit.

2) It doesn't actually happen with every file and every save. It *does* seem to happen consistently with a file once it starts happening. I have some Python files that I've saved hundreds of times over the past month or so, and Gatekeeper quarantines them every time.

Does anyone know what's going on here? Is anyone else having this experience?

Rich Siegel

unread,
Dec 2, 2017, 2:43:04 PM12/2/17
to bbe...@googlegroups.com
On 12/1/17 at 2:43 PM, sfs...@gmail.com (David Stein) wrote:

>But I'm continuously running into an issue with High Sierra and
>Gatekeeper, which is part of MacOS's security and malware infrastructure.
>
>The problem is that almost any .py file I create or edit with
>BBEdit gets instantly flagged by Gatekeeper as "an untrusted
>file from the internet," and it gets quarantined. [...]

You left out a very important part of your exchange with Tech
Support, which is this: the quarantine attribute is being added
to your files by
"com.apple.CloudDocs.MobileDocumentsFileProvider", which is the
signature of the iCloud Drive service.

Thus, as Tech Support advised, the quarantine attribute is being
added to files stored in your iCloud Drive folder (or any folder
therein) *by* iCloud Drive.

As to how you might stop iCloud Drive from quarantining your
Python files, that really depends on why iCloud Drive is
applying the quarantine, and I don't think anyone who doesn't
have the source code to the OS can tell you (and someone who
does have the source code to the OS likely won't).

If it's because the files are executable, then you could try this:

defaults write com.barebones.bbedit
MakeShebangScriptsExecutable -bool NO

This may have unintended consequences, though, since there are
many legitimate situations in which a #! script file needs to be executable.

If that doesn't work, or if it creates other problems for your
workflow, then your only alternative is to use Dropbox or some
other service to synchronize files between your computers.

If you don't need syncing, just turn off iCloud Drive (after
rescuing everything you need, since iCloud seems to like
deleting things when you turn it off).

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Reply all
Reply to author
Forward
0 new messages