Skip to content

Bend killed with SIGKILL on macOS (Apple Silicon) after updating via install.sh #1025

Closed

Description

@z5h

What you did

bend

What happened

**Bend killed with SIGKILL on macOS (Apple Silicon) after updating via install.sh**

After updating with `curl -fsSL https://bend-lang.com/install.sh | sh`, every invocation of `bend` failed immediately with:


terminated by signal SIGKILL (Forced quit)


**Cause:** the installed binary's code signature is invalid. On arm64 macOS the kernel requires every executable to have a valid signature (ad-hoc is fine) and kills the process at launch if the code pages don't match it.


$ file ~/.bend/bin/bend
Mach-O 64-bit executable arm64

$ codesign -dvvv ~/.bend/bin/bend
Signature=adhoc
flags=0x20002(adhoc,linker-signed)

$ codesign --verify --strict -vvv ~/.bend/bin/bend
invalid signature (code or signature have been modified)


The binary carries the linker-applied ad-hoc signature, but its contents were changed after linking, so the signature no longer matches.

**Workaround:** re-sign it ad-hoc:


codesign --force --sign - ~/.bend/bin/bend


After that it runs normally. This presumably needs repeating after each update until it's fixed upstream.

The file

bend --version

bend 2.0.27

uname -sm

Darwin arm64

clang --version (the first line)

Apple clang version 21.0.0 (clang-2100.3.34.2)

Activity

  1. added
    bug
    on Sep 23, 2026
  2. iamjoaovytor commented on Sep 24, 2026

    @iamjoaovytor

    Same here on 2.0.26 and 2.0.27 (Darwin arm64). Two details that may help locate where the binary gets modified after linking.

    Only the last code page fails. Parsing the LC_CODE_SIGNATURE SuperBlob and re-hashing every page against the CodeDirectory, exactly 1 of 15551 slots mismatches — the final, partial one:

    file size 64191218   sig off 63693472   sig size 497746
    CodeDirectory v=0x20400  nCodeSlots=15551  codeLimit=63693472  pageSize=4096
    mismatched pages: 1 -> [15550]   (bytes 63692800..63693472)
    

    That range is the tail of the __LINKEDIT string table (it ends in ..._expm1\0___exp10\0_log10\0 plus zero padding), so whatever runs after the linker signs the image writes near the end of the string table, not into __TEXT.

    The executable is a Bun single-file build. A bend --help that fails for another reason prints Bun v1.4.0 (macOS arm64) and paths under /$bunfs/root/bend, so this is bun build --compile, which injects its payload and re-signs — that step looks like the suspect. Worth noting the signature blob ends exactly at EOF (63693472 + 497746 = 64191218), so nothing is appended past the signature; the payload lives inside the image.

    2.0.26 is affected too, so it is not new in 2.0.27. The downloaded tarball's sha256 matches the value baked into install.sh, so the published artifact itself is unsigned-invalid, not the download.

    codesign -f -s - ~/.bend/bin/bend does fix it. Since bend update re-runs install.sh, the re-sign has to be repeated after every upgrade — an explicit codesign -f -s - on the compiled output in the release script would settle it upstream.

  3. Lorenzobattistela commented on Sep 24, 2026

    @Lorenzobattistela
    Collaborator

    Were previous versions not affected? I suspect this is due to Darwin or maybe Bun version, because I could not reproduce here in my end, macOs Darwin 26.5.2. It seems that the issue is present in all previous releases as well. Will be fixed in release 2.0.28

  4. dearlordylord commented on Sep 25, 2026

    @dearlordylord
    Contributor

    anecdotically, happened to me only in latest version after "bend update". that said, I installed the previous one with an agent, maybe it codesigned it sneakily

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions