Skip to content

fix(sidecar/prepare-node): ad-hoc sign bundled node so tauri dev works#16

Merged
mrdulasolutions merged 1 commit into
mainfrom
claude/preparenode-adhoc-sign
May 13, 2026
Merged

fix(sidecar/prepare-node): ad-hoc sign bundled node so tauri dev works#16
mrdulasolutions merged 1 commit into
mainfrom
claude/preparenode-adhoc-sign

Conversation

@mrdulasolutions
Copy link
Copy Markdown
Owner

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

code object is not signed at all

aos-mail-node --version

[process gets SIGKILL'd by amfid]
```

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

Signature=adhoc

aos-mail-node --version

v24.14.0 (exit 0)
```

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

`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>
@mrdulasolutions mrdulasolutions merged commit 1787be9 into main May 13, 2026
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant