What should I do about com.apple.quarantine?

93

20

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?

Jason S

Posted 2009-08-23T21:10:07.253

Reputation: 5 983

Answers

64

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.

mark4o

Posted 2009-08-23T21:10:07.253

Reputation: 4 729

except it isn't removed on open and seems to persist indefinitely, even when dragged to /Applications – Erik Aigner – 2019-08-22T10:13:00.143

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 – 2009-08-23T22:02:35.010

85

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

Arjan

Posted 2009-08-23T21:10:07.253

Reputation: 29 084

1I have a number of files like this and have had to manually remove the xattr as OS X did not ask for permission... – Brian Knoblauch – 2017-06-26T12:54:13.340

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 – 2017-06-26T13:31:43.610

1Thanks for the xattr incantation, less bother than figuring out how to trigger some inappropriate (IMO) dialogue on a framework. – Sue Spence – 2018-04-25T21:47:02.650

23

 xattr -d com.apple.quarantine /path/to/file

Richard Hoskins

Posted 2009-08-23T21:10:07.253

Reputation: 10 260

2find /path/to/dir -exec xattr -d com.apple.quarantine {} \; – sepehr – 2015-07-16T16:30:30.960

3Don't use sudo when you don't have to. – s4y – 2009-08-25T15:17:35.740

1Edited the answer to remove 'sudo'. – Richard Hoskins – 2009-08-25T16:10:12.873

1How do you do this recursively to all files in a directory? – Landon Kuhn – 2012-03-27T19:50:18.007

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 – 2013-07-23T01:45:41.317

6

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.

Lri

Posted 2009-08-23T21:10:07.253

Reputation: 34 501

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.

user32911

Posted 2009-08-23T21:10:07.253

Reputation:

4You don't need the while... loop. find can do it all: " find Application.app -print -exec xattr -d com.apple.quarantine {} ; " – rivimey – 2015-06-15T16:47:56.223

"option -r not recognized" – Jamie Ivanov – 2016-12-05T16:16:42.397

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 – 2017-04-05T14:31:35.883

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. – user2531336 – 2019-01-07T08:40:10.307

9You could also use xattr -rd com.apple.quarantine Application.app. – Lri – 2012-09-22T09:22:27.317

0

xattr now has a -r flag to recurse. So you don't have to go through that find stuff. Also it has a -c that will clear ALL flags (including FinderInfo), not always recommended unless you're really mad at it. :-)

OsamaBinLogin

Posted 2009-08-23T21:10:07.253

Reputation: 101

uh... which question are you answering? – Jason S – 2019-06-03T19:47:03.040

It looks like you're commenting on another answer in this question (https://superuser.com/a/126227/1162) rather than providing an answer on your own.

– Jason S – 2019-06-03T19:48:11.507