fix(sidecar/prepare-node): ad-hoc sign bundled node so tauri dev works#16
Merged
Merged
Conversation
`npm run tauri:dev` was unusable on macOS 14.4+ (and stricter on 15+): the bundled aos-mail-node binary spawned and was immediately SIGKILL'd by `amfid` (Apple Mobile File Integrity), so the sidecar died on launch with `WARN sidecar terminated: signal: Some(9)`. Tauri's shell plugin then logged `sidecar stdin write failed: Broken pipe` and the app sat broken at the splash. Root cause: prepare-node-binary.mjs explicitly strips the Node Foundation signature (`codesign --remove-signature`) with a comment that "Tauri will re-sign with our Developer ID at bundle time." That's true for `tauri build` (via tauri-action's keychain dance), but in `tauri dev` nothing re-signs — the binary stays unsigned, and modern macOS refuses to execute unsigned arm64 Mach-O binaries. Fix: after the strip, add a `codesign --sign - --force` ad-hoc signing step. Ad-hoc signatures satisfy `amfid` for local execution and don't interfere with tauri-action's later `codesign --force` with the real Developer ID cert in production builds — `--force` replaces whatever signature is there. Verified locally: `aos-mail-node --version` now returns v24.14.0 (exit 0) instead of dying with exit 137. The running `tauri dev` session picked up the new binary on its next file-change rebuild and the sidecar booted cleanly: `sidecar: ready, listening on stdin`. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`npm run tauri:dev` is unusable on macOS 14.4+ / 15+: the bundled `aos-mail-node` binary spawns and is immediately SIGKILL'd by `amfid` (Apple Mobile File Integrity), so the sidecar dies on launch and the app hangs at the splash.
Symptoms in the dev log:
```
WARN sidecar terminated: TerminatedPayload { code: None, signal: Some(9) }
ERROR sidecar stdin write failed: Broken pipe (os error 32)
```
Root cause
`prepare-node-binary.mjs` strips Node Foundation's signature with the comment "Tauri will re-sign with our Developer ID at bundle time." That's true for `tauri build` (where `tauri-action` runs a `codesign --force` pass in its keychain dance, see PRs #2/#9/#10), but in `tauri dev` nothing re-signs. The binary stays unsigned, and modern macOS refuses to execute unsigned arm64 Mach-O binaries:
```
codesign -dv aos-mail-node
aos-mail-node --version
Fix
After the strip, add a `codesign --sign - --force` ad-hoc signing step. Ad-hoc signatures satisfy `amfid` for local execution and don't interfere with tauri-action's later `codesign --force` with the real Developer ID cert in production builds — `--force` replaces whatever signature is there.
Verification
Local re-run of `node sidecar/scripts/prepare-node-binary.mjs`:
```
codesign -dv .../aos-mail-node
aos-mail-node --version
Running `tauri dev` session detected the file change, recompiled in 10s, and on next launch the sidecar booted cleanly:
```
[sidecar-boot] sidecar: ready, listening on stdin
```
(was previously crashing immediately with signal 9)
Risk
Trivial. Ad-hoc sign happens once at sidecar build, before tauri-bundler. Production builds replace it via tauri-action's codesign --force; tested in v0.1.8 release.
🤖 Generated with Claude Code