Repository navigation
Description
Description
Description
The opencode binary crashes immediately on launch on older Intel Macs with the following error:
EXC_BAD_INSTRUCTION (SIGILL)
Illegal instruction: 4
This happens before the application fully initializes (during dyld initializer phase).
Environment
- macOS: 13.7.4
- Machine: Macmini6,2 (Intel Ivy Bridge, 2012)
- CPU: x86_64 (supports AVX, but NOT AVX2)
- Installation method: Homebrew (
anomalyco/tap/opencode)
Crash details
Relevant excerpt:
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Termination Reason: Illegal instruction: 4
Thread 0 Crashed:
0 opencode ...
...
dyld4::Loader::findAndRunAllInitializers
Instruction stream shows AVX-prefixed opcodes (e.g. c4 ...), which indicates usage of instructions not supported by this CPU.
Root cause (analysis)
The distributed binary:
opencode-darwin-x64.zip
appears to be compiled targeting a modern x86_64 CPU baseline (likely x86-64-v3 or -march=native), which requires AVX2.
However:
- Ivy Bridge CPUs only support AVX1, not AVX2
- Executing AVX2 instructions results in
SIGILL(illegal instruction)
Because the Homebrew formula only downloads a prebuilt binary (no local compilation), there is no way to adapt the build to older CPUs.
Why this matters
This makes the tool unusable on:
- Intel Macs pre-Haswell (≈ 2013 and earlier)
- Any x86_64 CPU without AVX2 support
These machines are still relatively common in development environments.
Suggested fixes
1. Provide a baseline-compatible build
Publish an additional binary targeting a more compatible baseline, e.g.:
x86-64(v1/v2)- or
-march=nehalem/-C target-cpu=x86-64
Example naming:
opencode-darwin-x64-legacy.zip
2. Avoid -march=native in release builds
If currently used, this should be avoided for distributed binaries, as it makes them dependent on the build machine CPU.
3. Explicit target configuration
Depending on the toolchain:
-
Rust
RUSTFLAGS="-C target-cpu=x86-64" -
Go
GOAMD64=v1 -
Bun / Zig / others
Ensure target is not implicitlyx86-64-v3
4. (Optional) Document CPU requirements
If AVX2 is required by design, it would be helpful to explicitly document:
Requires x86_64 CPU with AVX2 support
Workarounds
Currently, there is no workaround via Homebrew, since it only installs the prebuilt binary.
Summary
- Crash is caused by AVX2 instructions on non-AVX2 CPU
- Not a macOS issue or misconfiguration
- Requires either a compatible build or documented requirement
Plugins
No response
OpenCode version
last
Steps to reproduce
run brew install anomaly/tap/opencode
Screenshot and/or share link
No response
Operating System
macOS 13.7.4
Terminal
native macOS terminal
Activity
github-actions commentedon Apr 29, 2026
This issue might be a duplicate of existing issues. Please check:
marcioganzer commentedon Apr 29, 2026
This seems to be a distribution/packaging issue rather than a runtime bug.
The current release (
opencode-darwin-x64) appears to be built targeting a modern x86_64 baseline (likely x86-64-v3 / AVX2). On CPUs without AVX2 support (e.g. Ivy Bridge), this results in an immediateSIGILLon startup.From what I can see, the installer (or upstream tooling such as llm-agents) always selects the same binary, without considering CPU capabilities.
Suggested approach
A robust fix would be one of the following:
Provide multiple x86_64 builds
x86-64-v1(baseline, no AVX2 — compatible with older CPUs)x86-64-v3(AVX2 optimized)Select binary dynamically at install time
Fallback strategy
Why this matters
Without this, the current binary is unusable on:
This is not a misconfiguration — the binary itself is incompatible with the CPU.
Happy to test a baseline-compatible build if one is provided.
diwu-sf commentedon Jun 1, 2026
I think the fix belongs in
packages/opencode/script/build.ts.The
-baselinebinaries are built, but not used in the packaged asset.If the published binary were mapped to the
-baselinebuilds, then it would work on CPUs without AVX2.It's also not just a Mac problem, it's also a problem on linux and windows.
tobocop2 commentedon Jul 15, 2026
Update — root cause found, upstream fix open, and there are builds you can try.
What's actually wrong
bun ships no baseline macOS build.
@oven/bun-darwin-x64-baselineis byte-identical to@oven/bun-darwin-x64(both the AVX2 build), which is why opencode's-baselineMac binary is too. That's because oven-sh/WebKit never builds a baseline macOS WebKit —bun-webkit-macos-amd64-baseline.tar.gzreturns HTTP 404.opencode's own packaging is fine —
build.tsrequestsbun-darwin-x64-baselinecorrectly; there just isn't a real one upstream.Full evidence: oven-sh/bun#34206
Upstream fix (open now)
darwin-x64-baseline(draft; gated on the WebKit PR)Builds you can try today
👉 https://github.com/tobocop2/opencode-bun-pre-avx2-mac/releases/latest
I built a baseline bun and compiled opencode against it:
ymm) instructionsopencode-darwin-x64-baseline@oven/bun-linux-x64-baseline(verified working on real pre-AVX2 hardware)I need testers — I couldn't test this on a real Mac. I experienced this issue personally on my moms 2013 intel mac, but I no longer have access to it.
No cloud provider rents a pre-AVX2 Intel Mac, so I verified the recipe on a pre-AVX2 linux box instead (the baseline runs
opencode runto completion there; the AVX2 build crashes after ~21s / ~3.9 GB). If you have one of these Macs, I'd genuinely appreciate a report either way:Unofficial builds — not affiliated with oven-sh or anomalyco, just a stopgap until the PRs land.
marcioganzer commentedon Jul 17, 2026
@tobocop2
I just tested the opencode-darwin-x64-baseline build on my Mac Mini Late 2012 (Ivy Bridge).
I can confirm that the application runs successfully without any SIGILL crashes. The performance is a bit slower compared to modern machines, but it is fully functional and stable enough for use.
Thank you for providing the baseline build!
tobocop2 commentedon Jul 17, 2026
glad to hear! and no problem!
tobocop2 commentedon Aug 5, 2026
Surfacing this again. @jlongster sorry to ping but I think I need an opencode maintainers help to nudge the
oven-shteam.My builds are getting downloads (35 so far) and that's without me publicizing this in any capacity outside of these github issue comments.
https://github.com/tobocop2/opencode-bun-pre-avx2-mac
opencode: add baseline (x86-64-v2) variant for pre-Haswell CPUs
neriousy commentedon Oct 1, 2026
Closing as a duplicate of #8345, which tracks OpenCode crashing with an illegal instruction on older Intel CPUs without AVX2. Please add your CPU model and 👍 there.