Skip to content

Instantly share code, notes, and snippets.

@coolaj86
Last active May 24, 2022 15:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coolaj86/22da9c8eb80b44e07640eb9d01aaa741 to your computer and use it in GitHub Desktop.
Save coolaj86/22da9c8eb80b44e07640eb9d01aaa741 to your computer and use it in GitHub Desktop.

Restore the default spctl database:

sudo spctl --reset-defaults
sudo cp /var/db/.SystemPolicy-default /var/db/SystemPolicy
# reboot may be required

Add the quarantine back:

my_application="cURL"
my_date=$(printf %x $(date +%s))
my_uuid=$(/usr/bin/uuidgen)
/usr/bin/xattr -w com.apple.quarantine "0002;${my_date};${my_application};${my_uuid}" ~/Downloads/CHANGE_ME_WHATEVER

my_download_url="http://example.com/example.ext"
my_date=$(($(date +%s) - 978307200))
/usr/bin/sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV2 "INSERT INTO \"LSQuarantineEvent\" VALUES('${my_uuid}',${my_date},NULL,'${my_application}','${my_download_url}',NULL,NULL,0,NULL,'${my_url}',NULL);"

See: https://apple.stackexchange.com/questions/256625/how-to-set-restore-the-com-apple-quarantine-attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment