Skip to content

Commit 5c85083

Browse files
committed
fix: strip macOS quarantine on brew/curl/npm installs
Homebrew cask post-install and install.sh/npm postinstall clear com.apple.quarantine so Gatekeeper does not block unsigned darwin binaries until Developer ID notarization ships.
1 parent 8b9cf8b commit 5c85083

4 files changed

Lines changed: 65 additions & 3 deletions

File tree

‎.goreleaser.yaml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ homebrew_casks:
102102
email: 41898282+github-actions[bot]@users.noreply.github.com
103103
binaries:
104104
- autodevelop
105+
# Unsigned until Apple Developer ID + notarize.
106+
# Homebrew casks quarantine downloads; strip so Gatekeeper does not block first run.
107+
hooks:
108+
post:
109+
install: |
110+
if OS.mac?
111+
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}"]
112+
end
105113
106114
scoops:
107115
- name: autodevelop

‎packaging/macos/README.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# macOS Gatekeeper / quarantine
2+
3+
Copyright (c) 2026 Devrecated.
4+
5+
Unsigned darwin binaries from GitHub Releases get `com.apple.quarantine`.
6+
Gatekeeper then blocks first launch until notarized (Apple Developer ID).
7+
8+
## Immediate unblock (already-installed binary)
9+
10+
```bash
11+
# Homebrew cask
12+
xattr -dr com.apple.quarantine /opt/homebrew/Caskroom/autodevelop
13+
# Intel Homebrew:
14+
# xattr -dr com.apple.quarantine /usr/local/Caskroom/autodevelop
15+
16+
# Direct download / curl install
17+
xattr -d com.apple.quarantine "$(command -v autodevelop)"
18+
```
19+
20+
## What we ship
21+
22+
| Channel | Quarantine strip |
23+
|--------|-------------------|
24+
| `scripts/install.sh` | `xattr -d` after install |
25+
| npm postinstall | `xattr -d` after download |
26+
| Homebrew cask | GoReleaser `hooks.post.install` runs `xattr -dr` on `staged_path` |
27+
| Direct Releases asset open | Manual one-liner above |
28+
29+
## Real fix
30+
31+
Apple Developer ID signing + notarization in the release pipeline. Until then the
32+
`xattr` strips above are intentional.

‎packaging/npm/install.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,16 @@ async function main() {
7676
if (process.platform !== "win32") {
7777
fs.chmodSync(dest, 0o755);
7878
}
79+
// Gatekeeper: strip quarantine on unsigned darwin downloads.
80+
if (process.platform === "darwin") {
81+
try {
82+
execFileSync("xattr", ["-d", "com.apple.quarantine", dest], {
83+
stdio: "ignore",
84+
});
85+
} catch {
86+
/* attribute may be absent */
87+
}
88+
}
7989

8090
try {
8191
const out = execFileSync(dest, ["version"], { encoding: "utf8" }).trim();

‎scripts/install.sh‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,22 @@ done
7373
chmod +x "$tmpbin"
7474
install_dir="${AUTODEVELOP_INSTALL_DIR:-${HOME}/.local/bin}"
7575
mkdir -p "$install_dir"
76-
install -m 755 "$tmpbin" "${install_dir}/${BIN_NAME}"
77-
echo "Installed ${install_dir}/${BIN_NAME} (${tag})"
76+
dest="${install_dir}/${BIN_NAME}"
77+
install -m 755 "$tmpbin" "$dest"
78+
79+
# Gatekeeper: unsigned darwin binaries carry com.apple.quarantine from the download.
80+
# Strip it so first launch is not blocked (until we notarize).
81+
if [ "$os" = "darwin" ]; then
82+
if [ -w "$dest" ]; then
83+
xattr -d com.apple.quarantine "$dest" 2>/dev/null || true
84+
else
85+
sudo xattr -d com.apple.quarantine "$dest" 2>/dev/null || true
86+
fi
87+
fi
88+
89+
echo "Installed ${dest} (${tag})"
7890
case ":$PATH:" in
7991
*":${install_dir}:"*) ;;
8092
*) echo "Add ${install_dir} to PATH if needed." ;;
8193
esac
82-
"${install_dir}/${BIN_NAME}" version || true
94+
"$dest" version || true

0 commit comments

Comments
 (0)