Removing Mac Files From Quarantine

9th December 2021 | Programming

When setting up a new Mac running macOS Big Sur, I tried to open a BBEdit Clipping that was transferred via AirDrop, which resulted in this error:

"Current Date" cannot be opened because it is from an unidentified developer.
macOS cannot verify that this app is free from malware.
Durenor sent you this file on November 17, 2021.

Then that error was followed by another delightful error:

The application "BBEdit.app" can't be opened.
-128

Interestingly enough, it was possible to open these Clippings from the command line text editor pico. When I installed the BBEdit command line tools, I was also able to open the Clipping with the command bbedit Current\ Date. But trying to open the file from Finder did not work.

Right-clicking and selecting Open should work as a work around, similar to how to open unidentified apps. I figured this was an issue with the files being quarantined, so I looked for the command line solution.

How to check if a file is quarantined using the Terminal by using the xattr command:

Clippings % xattr Current\ Date 
com.apple.LaunchServices.OpenWith
com.apple.TextEncoding
com.apple.quarantine

To remove the quarantine tag, use the xattr -d com.apple.quarantine command on the quarantined file.

% xattr -d com.apple.quarantine Current\ Date 

Then check again to verify that com.apple.quarantine has been removed.

% xattr Current\ Date                      
com.apple.LaunchServices.OpenWith
com.apple.TextEncoding
com.apple.lastuseddate#PS

References