The Pug Automatic

Lift the Leopard download quarantine

Written October 29, 2007. Tagged OS X, AppleScript.

A Vista-esque feature of OS X Leopard is that it tags web downloads (not just from Safari) as such and then warns you about running downloaded apps or scripts. Archived (e.g. zipped) files inherit the tag from their tagged container.

[Screenshot]

This is an annoyance to power users. Luckily, being a power user, I can do something about it. ;)

Stick Unquarantine.scpt in ~/Library/Scripts/Folder Action Scripts. You'll probably need to create the Scripts directory and its subdirectory, e.g. with mkdir -p ~/Library/Scripts/Folder\ Action\ Scripts.

Go to ~/Downloads or wherever your downloads go.

Right-click, More > Configure Folder Actions…. Check "Enable Folder Actions". Attach the "Unquarantine" action to the folder.

[Screenshot]

And that should be it.

Note that, quite obviously, the folder action only applies to that folder. If you download a file to a directory without this folder action attached, Leopard is free to nag again.

The code

Basically, the script just runs

xattr -d com.apple.quarantine "downloaded_file.zip"

Do xattr -h in a terminal for help (just xattr is silent, and there's no man page).

The code:

(*
"Unquarantine" by Henrik Nyh </2007/10/lift-the-leopard-download-quarantine>
This Folder Action handler is triggered whenever items are added to the attached folder.
It gets rid of Leopard's annoying "this application was downloaded from the Internet" warnings by stripping the "quarantine" property.
*)


on adding folder items to thisFolder after receiving addedItems

repeat with anItem in addedItems
set anItem's contents to (quoted form of POSIX path of (anItem as alias))
end repeat

set AppleScript's text item delimiters to " "
do shell script "xattr -d com.apple.quarantine " & (addedItems as text)

end adding folder items to