How do I disable the "XXX is an app downloaded from the Internet" warning? [duplicate]

I have a bunch of files I copied from another computer and am unable to use them as I get various security and permission errors.

When I compile using Xamarin I get permission denied. When I try to open a file directly I get this error:

enter image description here

How can I remove the system attribute that causes this security dialog to appear?

(Yes, for some files I can use the following but this needs to apply to all files and folders)

enter image description here


Solution 1:

You can get around this a few ways.

1. Easiest and Most Recommended: Select the file in Finder, right/control-click on the file and choose “Open”. You will be asked if you want to open the file, even if it is from an unknown developer.

2. Slightly More Complicated, but Sometimes Preferable: If you are not afraid of Terminal.app (found in the /Applications/Utilities folder of Finder), you can remove the “Quarantine” attribute using this command:

xattr -r -d com.apple.quarantine /path/to/folder

For example, if all of the files are in ~/Downloads/ then you would use:

xattr -r -d com.apple.quarantine ~/Downloads/

or

xattr -r -d com.apple.quarantine "$HOME/Downloads/"

Type man xattr into Terminal.app for more information about the xattr command, but the short version is that -r means “recursive” and -d means “delete the following attribute”.

Solution 2:

Open the Terminal app from the /Applications/Utilities/ folder and then enter the following command syntax:

sudo spctl --master-disable

Hit return and authenticate with an admin password

Relaunch System Preferences and go to “Security & Privacy” and the “General” tab

You will now see the “Anywhere” option under ‘Allow apps downloaded from:’ Gatekeeper options

enter image description here

Do not forget to change it back for your safety.

sudo spctl --master-enable