Skip to content

fix: codesign darwin binaries and smoke-test on CI#68

Merged
dylanjha merged 5 commits intomainfrom
dj/darwin-signing-fix
Apr 16, 2026
Merged

fix: codesign darwin binaries and smoke-test on CI#68
dylanjha merged 5 commits intomainfrom
dj/darwin-signing-fix

Conversation

@dylanjha
Copy link
Copy Markdown
Contributor

@dylanjha dylanjha commented Apr 16, 2026

Summary

  • bun 1.3.12 regressed ad-hoc signing for bun build --compile on darwin-arm64 (1.3.11 produced adhoc,linker-signed Mach-O; 1.3.12 produces no signature at all),
  • this made the binary unusable on macOS
  • This is broken in 1.3.0 that just went out moments ago

This PR

  • smoke test to catch this in CI
  • codesign fix — adds explicit codesign --sign for darwin targets so we don't depend on toolchain-implicit signing (follow-up commit, pushed after the first CI run)

Test plan

  • Confirm CI fails on the Build (darwin-arm64) smoke-test step on the first commit
  • After the codesign fix is pushed, confirm CI goes green
  • Cut v1.3.1 after merge and verify `mux --version` runs on a real arm64 Mac

🤖 Generated with Claude Code


Note

Low Risk
Workflow-only changes that affect build/release validation; main risk is CI/release failures if signing commands or runner environments behave differently across macOS targets.

Overview
Adds explicit ad-hoc codesigning for darwin-* build outputs in both ci.yml and release.yml by stripping any existing signature and re-signing via codesign --sign -.

Adds a smoke test step to run ./dist/mux-<target> --version for every built target, and verifies macOS artifacts are properly codesigned with codesign --verify --strict before uploading/releasing.

Reviewed by Cursor Bugbot for commit 2171b14. Bugbot is set up for automated code reviews on this repo. Configure here.

dylanjha and others added 3 commits April 16, 2026 14:37
Build jobs now execute the produced binary with --version as a
post-build step. This surfaces launch-time failures (such as a missing
ad-hoc signature on darwin-arm64, which causes the kernel to SIGKILL
the process) before they reach users.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
macOS 15 (the current GitHub Actions runner) still launches unsigned
arm64 binaries, but macOS 26 (Tahoe) kills them with SIGKILL — so a
plain --version smoke test won't catch the missing signature on CI
even though it breaks every user on a current macOS.

codesign --verify fails deterministically on any unsigned Mach-O
regardless of the runner's enforcement posture, so the regression
surfaces before shipping.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Use -vvv so the build log shows exactly what's wrong with the
signature on failure, not just a non-zero exit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/release.yml
dylanjha and others added 2 commits April 16, 2026 14:43
bun 1.3.12 regressed the linker-embedded ad-hoc signature that
1.3.11 produced for 'bun build --compile' output on darwin. macOS 26
(Tahoe) refuses to launch unsigned arm64 binaries (SIGKILL on exec),
so v1.3.0 shipped broken for every user on current macOS.

Explicitly ad-hoc sign the darwin binaries with 'codesign --sign -'
instead of depending on the toolchain, then verify with 'codesign
--verify --strict' so a future regression fails the build.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bun 1.3.12 leaves signature bytes in the Mach-O that codesign cannot
parse, so 'codesign --sign - --force' fails with 'invalid or
unsupported format for signature'. Run --remove-signature first to
clear the stub, then sign from scratch.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2171b14. Configure here.

Comment thread .github/workflows/ci.yml
if: startsWith(matrix.target, 'darwin-')
run: |
codesign --remove-signature ./dist/mux-${{ matrix.target }}
codesign --sign - ./dist/mux-${{ matrix.target }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Buggy --remove-signature used instead of documented --force

High Severity

The PR description states it "adds explicit codesign --sign - --force" but the implementation instead uses a two-step codesign --remove-signature followed by codesign --sign - (without --force). The --remove-signature flag is an undocumented macOS feature known to be buggy — it can corrupt binaries or fail randomly. The standard practice is a single codesign --sign - --force call, which atomically replaces any existing signature. Since this runs on release artifacts, a corrupted binary would ship broken builds to users.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2171b14. Configure here.

Copy link
Copy Markdown
Contributor Author

@dylanjha dylanjha Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor, I don't think you're right about this -- we first tried --force in this commit c914d6f

And that did not work

Screenshot 2026-04-16 at 2 54 48 PM

If anything, --force seems to be problematic -- at least for older versions of macos:

Screenshot 2026-04-16 at 2 53 42 PM

--remove-signature is documented. It's in the manual in man codesign. It also seems to be the preferred path instead of --force

Screenshot 2026-04-16 at 2 58 57 PM

We prove in the CI on this branch that signing works, we can verify the signing worked, and we can run the binary. The other path you suggest we tried, and CI failed.

So I think we have the best solution.

@dylanjha dylanjha merged commit 4c960b6 into main Apr 16, 2026
8 checks passed
@dylanjha dylanjha deleted the dj/darwin-signing-fix branch April 16, 2026 21:59
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