How to remove the “downloaded from the internet” security from all files in a directory

finderpermissionSecurity

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

Best Answer

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”.