How can we force MacOS to forget that a specific file was downloaded from the web?
-
28-05-2021 - |
Question
MacOS remember that things were downloaded. MacOS refuse to open or execute script downloaded and prompt the famous message:
cannot be opened because it is from an unidentified developer.
Can I make MacOS forget this file was downloaded?
I know I can do a right-click -> open. But I want to avoid the additional hassle for specific files. The protection is particularly annoying for bash script you may want to open in a text editor multiple time. I'm well aware of the risk of exectuting a downloaded script.
I also know I can remove the protection altogether, but I don't want that.
In the info of the files, you have the information but it's not editable:
Solution
You can delete the download source by running
xattr -d com.apple.metadata:kMDItemWhereFroms FILENAME
To also remove the quarantine flag use
xattr -d com.apple.quarantine FILENAME
PS: If FILENAME
is an application (ends in .app
), add -r
to have the attributes removed from all files within the application.
OTHER TIPS
To create an app that can do this from the GUI, launch Automator. Select New -> Application
In the Actions Library, go to Utilities and select "Run Shell Script" In the Pass Input drop-down menu, select Select "As arguments"
Where it says echo "$f"
, replace it with
xattr -d -r com.apple.metadata:kMDItemWhereFroms $f
xattr -d -r com.apple.quarantine $f
So the content of the shell script is
for f in "$@"
do
xattr -d -r com.apple.metadata:kMDItemWhereFroms $f
xattr -d -r com.apple.quarantine $f
done
Save the app as "DeQuarantine.app" in a location you find convenient for Drag-and-drop (I put it on the Desktop).
Then, when you have downloaded files you want to remove the warnings from, drop them on this app.