Skip to content

fix: Remove --bytecode flag to fix Mach-O signing corruption on M4#43

Open
alfep wants to merge 1 commit into
freecodexyz:mainfrom
alfep:fix/mach-o-signing-m4
Open

fix: Remove --bytecode flag to fix Mach-O signing corruption on M4#43
alfep wants to merge 1 commit into
freecodexyz:mainfrom
alfep:fix/mach-o-signing-m4

Conversation

@alfep

@alfep alfep commented Jul 20, 2026

Copy link
Copy Markdown

Summary

Remove --bytecode from scripts/build.ts to fix Mach-O binary corruption
on Apple Silicon (M4). The bytecode flag produces structurally corrupted binary
headers, causing macOS Gatekeeper to SIGKILL the process immediately.

Root Cause

bun build --compile --bytecode injects bytecode alongside the native Mach-O
binary. On modern Apple Silicon, this bytecode overlay corrupts the code-signing
layout enforced by the macOS kernel. Gatekeeper rejects the malformed signature
and kills the process — hence the zsh: killed crash.

Fix

Removing --bytecode restores standard binary format compatibility. The binary
still compiles and minifies correctly — bytecode is an optimization layer
unnecessary for clean Mach-O output.

Test

  • file ./dist/cliMach-O 64-bit executable arm64
  • codesign --force --deep -s - ./dist/cli → succeeds (previously invalid or unsupported format)
  • ./dist/cli /login → no SIGKILL

Related

Closes #29

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

The --bytecode flag in bun build --compile produces structurally corrupted
Mach-O binary headers on Apple Silicon (M4), causing macOS Gatekeeper to
SIGKILL the process. Removing the flag restores standard binary format
compatibility.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 20, 2026 12:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Removes Bun’s --bytecode compilation flag from the build pipeline to avoid producing Mach-O binaries that macOS Gatekeeper/code-signing tools treat as structurally invalid on Apple Silicon (M4), addressing the immediate “zsh: killed” runtime failure described in #29.

Changes:

  • Drop --bytecode from the bun build --compile command assembled in scripts/build.ts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Bug: "zsh: killed" on macOS Apple Silicon (M4) due to corrupted Mach-O signature in compiled binary

2 participants