macOS Gatekeeper – Force Forget Downloaded File

gatekeepermacos

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:

enter image description here

Best Answer

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.