135

I've downloaded some .jar files from the internet and want to use them under Mac OS X. But the OS seems to have tagged them with the extended attribute com.apple.quarantine (no indication of this until I noticed the "@" in the ls -l and figured out how to use ls -l@) -- apparently because they have been downloaded from the internet. What's the right way to deal with this?

6 Answers 6

87

This attribute is added so that it can ask for user confirmation the first time the downloaded program is run, to help stop malware. Upon confirmation the attribute should be removed automatically, and then the program will run normally.

3
  • ahhhhhh.... ok that makes sense. So it's a contract between browser implementations that save files, and the OS and/or Java when it runs executables.
    – Jason S
    Aug 23, 2009 at 22:02
  • 4
    except it isn't removed on open and seems to persist indefinitely, even when dragged to /Applications
    – user52375
    Aug 22, 2019 at 10:13
  • this comment isn't fully correct anymore; as pointed out, the flag is now kept and Apple is even lying in that they are reporting that the application has been "damaged".
    – TheDiveO
    Feb 16 at 9:55
114

You don't have to deal with it. Open it and OS X will ask for your permission. Or like richard suggested, delete it using something like:

xattr -d com.apple.quarantine my_jar.jar

To do this automatically for any downloaded file you can attach a folder action to the download folder, like described on macosxhints.com in 10.5: Remove the 'downloaded file' warning flag.

And the following was posted on macosxhints.com a long time ago, for Safari: 10.5: Disable the 'downloaded from internet' file warning, claiming one can remove VerifiedDownloadPlugin.plugin from /Library/Internet Plug-Ins. I did not test that.

As an aside: sometimes one needs to start a single program multiple times on a Mac. That can be done using cd /Applications/some-application/ followed by open -n "Application Name.app". This really needs the .app suffix; running open -n "Application Name" might get one GateKeeper stopping access:

"Application Name" can't be opened because it is from an unidentified developer.

Your security preferences allow installation of only apps from the Mac App Store and identified developers.

Above, even removing the extended attribute com.apple.quarantine does not fix that, but using the .app suffix works just fine.

(I am not advising anyone to actually get rid of the security measures.)

3
  • 2
    I have a number of files like this and have had to manually remove the xattr as OS X did not ask for permission... Jun 26, 2017 at 12:54
  • 1
    @Brian, and did right-click, Open not prompt either? (That sometimes helps if OS X does prompt one, but does not show the option to continue.)
    – Arjan
    Jun 26, 2017 at 13:31
  • 1
    Thanks for the xattr incantation, less bother than figuring out how to trigger some inappropriate (IMO) dialogue on a framework.
    – Sue Mynott
    Apr 25, 2018 at 21:47
31
 xattr -d com.apple.quarantine /path/to/file
5
  • 2
    How do you do this recursively to all files in a directory? Mar 27, 2012 at 19:50
  • 1
    @landon9720 - The (currently) below answer has a comment that allows you to instruct xattr to work recursively over contents of a supplied directory
    – user66001
    Jul 23, 2013 at 1:45
  • 3
    find /path/to/dir -exec xattr -d com.apple.quarantine {} \;
    – sepehr
    Jul 16, 2015 at 16:30
  • I use xattr -cr . Jun 23, 2022 at 5:53
  • I just found out that Preview sets the quarantine flag upon opening an image file! I was wondering why it kept on being turned on on files that I'd downloaded years ago. Jun 23, 2022 at 17:23
7

You can disable the warnings permanently with defaults write com.apple.LaunchServices LSQuarantine -bool false. It also disables the Gatekeeper dialogs even if you haven't allowed applications downloaded from anywhere in System Preferences.

5

I found the following command

find Application.app | while read l; do echo $l; xattr -d com.apple.quarantine "$l"; done

very helpful when trying to get rid of the attribute. Note the double quotes around $l – you need them if your apps folder contains files with a blank in their name.

5
  • 14
    You could also use xattr -rd com.apple.quarantine Application.app.
    – Lri
    Sep 22, 2012 at 9:22
  • 5
    You don't need the while... loop. find can do it all: " find Application.app -print -exec xattr -d com.apple.quarantine {} \; "
    – rivimey
    Jun 15, 2015 at 16:47
  • "option -r not recognized" Dec 5, 2016 at 16:16
  • No need to spawn a new process for each file, nor do you have to remove the xattribute from the file if it doesn't have it in the first place: find . -xattrname com.apple.quarantine -print0 | xargs -0 xattr -d com.apple.quarantine
    – dland
    Apr 5, 2017 at 14:31
  • All these command line examples only work when you are in the directory containing the app. @dland find also has a -exec primary. find /Applications -xattrname com.apple.quarantine -exec xattr -d com.apple.quarantine {} \; You can replace /Applications with the full path you want, e.g. /Users/jdoe/Downloads If you are in the directory where the file is, just do xattr -d com.apple.quarantine <target> where <target> is a file or app name. Jan 7, 2019 at 8:40
-2

Here's a corollary answer to the question asked. For .app files, the quarantine is placed when the file is run, and removed when the user grants permissions in System Preferences. However, you still can't run the .app until you move it to the Applications folder. This is useful information for when you are distributing .apps informally, but you don't want users to have to run xattr as in the accepted answer.

Here's a passive aggressive comment about this insanity.

1
  • I often run apps that are not in /Applications. Also, the quarantine attribute is on the file as soon as it is downloaded; macOS does not wait until it is run.
    – WGroleau
    Sep 11, 2023 at 14:12

You must log in to answer this question.

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