Skip to content

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

@Anthony2cc

Description

@Anthony2cc

OS: macOS 15.7.4
CPU Architecture: Apple Silicon M4
Installation Method: Quick install script
After successfully installing the project via the quick install instructions, running the CLI results in an immediate crash:
zsh: killed free-code /login

When inspecting the underlying cli-dev file using the file command, it shows up correctly as a native executable: Mach-O 64-bit executable arm64. However, when trying to manually apply an ad-hoc signature to bypass Gatekeeper (codesign --force --deep -s - cli-dev), the built-in codesign tool rejects the file: cli-dev: invalid or unsupported format for signature.

Root Cause Analysis
It appears that packaging the CLI with bun build --compile introduces structural corruption to the Mach-O binary headers / code-signing layout on modern Apple Silicon architectures. Because the macOS kernel strictly enforces code signing, it sees the malformed signature layout and instantly terminates the process with SIGKILL. The file structure is so malformed that standard signing utilities refuse to operate on it.

Temporary Workaround
For anyone encountering this on M-series Macs, you can bypass the compiled binary entirely and use bun to execute the source file directly.
Delete the broken binary & Create a script file ~/free-code/cli.sh containing:
#!/bin/bash
cd ~/free-code
exec bun run ./src/entrypoints/cli.tsx "$@"
And then make it executable and re-link: chmod +x ~/free-code/cli.sh ln -s ~/free-code/cli.sh ~/free-code/cli-dev

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions