#!/bin/csh -f # unquarantine # ------------------------------------------------------------------------- # C shell script to delete the Mac OS X quarantine attribute that gets set # so often on downloaded or emailed files. # Note: See ~/fred/bin/o script for possible bug that turns it back on. # Note: It may be possible to stop files from ever being quarantined via: # defaults write com.apple.LaunchServices LSQuarantine -bool NO # See: # - http://hints.macworld.com/article.php?story=20091208050655947 # - https://rentzsch.tumblr.com/post/267379307 # /disable-and-recover-from-mac-os-xs-quarantine # - https://twitter.com/massivevector/status/5131862960 # ------------------------------------------------------------------------- # Revision History: # $Log$ # ------------------------------------------------------------------------- # Collect command line options set option_prefix_string = "" while ($#argv > 0) if ("$1" == "-h" || "$1" == "--help") then echo "Deletes the Mac OS X quarantine attribute." echo "Usage: $0:t [options] files..." echo "Options:" echo " -h = Show this help text" echo " --help = Show this help text" echo " -p prefix_string = Prefix each output line with prefix_string" echo "Examples:" echo " $0:t -q *.jpg" echo " $0:t -q -p 'Unquarantined: ' *.pdf " exit 1 else if ("$1" == "-p") then shift set option_prefix_string = "$1" shift else if ("-" == "`echo $1:q | cut -c 1`") then echo "Error: Invalid option: $1:q" $0 --help exit 1 else # Not a recognized option. Assume it's the first argument break endif end # At least 1 argument required if ($#argv < 1) then echo "Error: No filename specified." $0 -h exit 1 endif xattr_delete -v -p "$option_prefix_string" com.apple.quarantine $*:q