modd immediately killed on macOS ARM64 (Apple Silicon) with no useful error message
Description
On a new Apple Silicon Mac (macOS ARM64), running modd in a Go project results in the process being immediately killed with no helpful error messages. Even after reinstalling and attempting dry-run or debugger steps, the issue persists.
System Info
- macOS: Sonoma (Apple Silicon)
- Architecture: arm64
- Go version: go1.22.4 darwin/arm64
- Modd binary: built from latest version via go install github.com/cortesi/modd/cmd/modd@latest
Observed Behavior:
Running:
$ modd
results in:
[1] 22082 killed modd
Does go run github.com/cortesi/modd/cmd/modd@latest work? could be code signing issue, i've seen issues copying a binary over an old version, but removing it first works.
@wader Thanks for the suggestion to try go run github.com/cortesi/modd/cmd/modd@latest
Running directly via go run worked and that helped narrow down the issue.
Here's what I found.
-
moddwas being immediately killed with no output. -
go runworked fine, which suggested the issue wasn’t in the code itself. - I ruled out system-level issues like memory pressure, SIP, etc.
- It turned out that macOS was killing the binary due to an invalid code signature, confirmed via a crash report showing:
SIGKILL (Code Signature Invalid)
Termination Reason: Namespace CODESIGNING, Code 2 Invalid Page
The fix was to manually re-sign the binary with an ad-hoc signature:
codesign --force --deep --sign - /Users/can/Development/go/bin/modd