build: ad-hoc codesign macOS binaries after compile (fix Killed:9 on Apple Silicon)#114
build: ad-hoc codesign macOS binaries after compile (fix Killed:9 on Apple Silicon)#114miskaone wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesmacOS Ad-hoc Code Signing
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
On Apple Silicon, the OS SIGKILLs unsigned Mach-O executables. `bun build
--compile` output can land unsigned (or with a malformed signature slot),
so the produced `interceptor` / `interceptor-daemon` exit 137 ("Killed: 9")
with no output and the daemon never stays up under native messaging.
After the build, remove any existing signature and re-sign ad-hoc
(codesign --remove-signature, then codesign --force --sign -) for the CLI,
daemon, and bridge. Guarded to macOS with codesign present, so it is a no-op
on Linux/Windows or CI hosts without codesign.
bd51d23 to
c096b6f
Compare
There was a problem hiding this comment.
Pull request overview
This PR aims to prevent locally-built macOS binaries (compiled via bun build --compile) from being SIGKILL’d on Apple Silicon by ensuring the produced Mach-O outputs are ad-hoc codesigned after compilation.
Changes:
- Add a post-build macOS-only ad-hoc codesign step for produced binaries in
scripts/build.sh. - Extend
scripts/install.shto support targeting the “ChatGPT Atlas” browser for profile discovery, native-messaging host installation, and extension-loading instructions.
Reviewed changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| scripts/install.sh | Adds a new --atlas browser target and associated path detection / native-messaging install and extension-loading flows. |
| scripts/build.sh | Adds a Darwin-only post-build ad-hoc signing step intended to prevent Apple Silicon “Killed: 9” for unsigned compiled outputs. |
Comments suppressed due to low confidence (1)
scripts/build.sh:148
- The codesign step can silently leave broken binaries: if
codesign --force --sign -fails, the script still prints "Build complete" and exits 0. Since this signing is meant to prevent the Apple Silicon "Killed: 9" failure mode, the build should fail loudly when signing fails (and ideally avoid touching unrelated outputs when building--target=windows).
},
content_scripts: [
{ matches: ["<all_urls>"], js: ["net-buffer-content.js"], run_at: "document_start", all_frames: true },
{ matches: ["<all_urls>"], js: ["content.js"], run_at: "document_idle", all_frames: true }
]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Problem
On Apple Silicon, macOS SIGKILLs unsigned Mach-O executables.
bun build --compileoutput can land unsigned (or with a malformed signature slot), so the builtdist/interceptor/daemon/interceptor-daemonexit 137 ("Killed: 9") with no output, and the native-messaging daemon never stays up — everyinterceptorcommand then returns empty.Fix
After the build, remove any existing signature and ad-hoc re-sign the produced binaries:
for
dist/interceptor,daemon/interceptor-daemon, anddist/interceptor-bridge. Guarded to macOS withcodesignpresent, so it's a no-op on Linux/Windows or CI hosts without codesign. Windows.exeoutputs are not matched.Testing
interceptor --versionexits 137 with empty output;codesign -dv dist/interceptor→ "code object is not signed at all."interceptor --versionprints the version (exit 0);codesign -dv→Signature=adhoc; the daemon starts andinterceptor statusreportsdaemon: running.Ad-hoc signature only (no Developer ID / notarization) — sufficient to stop the OS kill for locally-built binaries.
Summary by CodeRabbit