17

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

  • 4
    Simple Gatekeeper bypass is right click>Open for first run. Have you tried that? – Tetsujin Jun 7 '20 at 15:35
  • 1
    @Tetsujin The question does say they know they can do that, although it is lacking in detail about why that's not a sufficient solution. – David Z Jun 8 '20 at 21:32
  • 1
    @DavidZ I think the gist is, the OP wants to avoid the additional hassle for specific files, while not having to turn off protection for every file. – jpaugh Jun 8 '20 at 21:53
42

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.

  • 4
    Add "-r" if you need to remove the attribute from an application, folder, or bundle – cobbal Jun 8 '20 at 18:52
0

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" image of Run Shell Script

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.

You must log in to answer this question.

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