Add my ‘sterilise’ script
- ID
0b05d89- date
2023-09-28 08:13:33+00:00- author
Alex Chan <alex@alexwlchan.net>- parent
e62524c- message
Add my 'sterilise' script- changed files
2 files, 29 additions
Changed files
macos/README.md (2303) → macos/README.md (2515)
diff --git a/macos/README.md b/macos/README.md
index 106e6db..8369033 100644
--- a/macos/README.md
+++ b/macos/README.md
@@ -68,6 +68,15 @@ They rely on Mac-specific stuff and are unlikely to be useful on non-Mac systems
<dd>
set the accent colour, as configured in the Appearance settings
</dd>
+
+ <dt>
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/sterilise">
+ <code>sterilise [PATH]</code>
+ </a>
+ </dt>
+ <dd>
+ alias for <code>xattr -d com.apple.quarantine</code>
+ </dd>
<dt>
<a href="https://github.com/alexwlchan/scripts/blob/main/macos/unlock_keychain">
macos/sterilise (0) → macos/sterilise (432)
diff --git a/macos/sterilise b/macos/sterilise
new file mode 100755
index 0000000..067ca89
--- /dev/null
+++ b/macos/sterilise
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# This removes the com.apple.quarantine attribute from files.
+#
+# This attribute is applied when you download a binary from the web,
+# and prevents you running it. This script is a quick alias for
+# removing that attribute if you know a file is safe.
+
+set -o errexit
+set -o nounset
+
+if (( $# == 0 ))
+then
+ echo "Usage: $0 <PATH>" >&2
+ exit 1
+fi
+
+for NAME in $@
+do
+ xattr -d com.apple.quarantine "$NAME"
+done