Skip to content

macOS: no x64 baseline build — @oven/bun-darwin-x64-baseline is byte-identical to the AVX2 default #34206

Closed as not planned

Description

@tobocop2

Summary

There is no baseline build for x64 macOS

@oven/bun-darwin-x64-baseline ships the same binary as @oven/bun-darwin-x64 — the AVX2 (-march=haswell) build.

Linux, by contrast, ships a genuine baseline.

Why it matters

On a pre-AVX2 Mac (Sandy/Ivy Bridge — no AVX2/FMA) that binary crashes, and there is no baseline package to fall back to.

This is the upstream cause of downstream reports like anomalyco/opencode#29039 — opencode's -baseline Mac binary SIGILLs on Ivy Bridge.

Who hits it

Pre-Haswell Intel Macs running a macOS that bun supports. Quoting the reports:

anomalyco/opencode#24876:

macOS: 13.7.4
Machine: Macmini6,2 (Intel Ivy Bridge, 2012)
CPU: x86_64 (supports AVX, but NOT AVX2)

macOS 13.7.4 clears bun's 13.0 deployment target; the CPU has no AVX2. That combination is the gap. Same reporter:

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.

anomalyco/opencode#29039:

MacBook Pro, Intel Core i7-3520M @ 2.90GHz
macOS 24.6.0 (Darwin)
sysctl -n hw.optional.avx2_0 returns 0 — no AVX2 support

That reporter independently confirmed the packaging bug straight from the Mach-O header:

otool -h shows cpusubtype 3 (CPU_SUBTYPE_X86_64_H — Haswell) for both

For my part, I run OpenCore Legacy Patcher on my mom's 2013 Intel Mac — current macOS, so it clears the deployment target, and the CPU is the only blocker.

Evidence

Every step is reproducible with curl — no bun internals involved.

1. The two darwin packages ship the same binary.

Download both npm packages and hash the bun binary inside each:

ea2f223e94bb2f4bf3050895113c3cf346438f6fa0501c8532284e063f72f7a0  @oven/[email protected]
ea2f223e94bb2f4bf3050895113c3cf346438f6fa0501c8532284e063f72f7a0  @oven/[email protected]

Identical hash, identical 69,173,328 bytes — byte-for-byte the same file. The "baseline" package is not a distinct build.

2. That binary is the AVX2 build.
Disassembling it (Mach-O, x86_64) finds 248,019 AVX2 (ymm) + 7,049 AVX-512 (zmm) instructions — i.e. the modern (-march=haswell) build, which a pre-AVX2 CPU can't run.

3. Linux ships a real baseline; darwin doesn't.

Same comparison on the linux packages — default and baseline are different binaries:

9fd36f87e4b90b07632b987a2e4ec81ca15a62c81bf983190cea6d715be2ad74  @oven/[email protected]
a8f9ebd1770ddc8e55dab7a68d4ec1ec1eebf374bb97cc65cf2c3cb373fc6791  @oven/[email protected]

And the linux baseline carries ~24× fewer AVX2 instructions:

npm package default vs baseline AVX2 instruction count
@oven/bun-linux-x64 (default) — 299,928
@oven/bun-linux-x64-baseline distinct 12,328
@oven/bun-darwin-x64 (default) — 248,019
@oven/bun-darwin-x64-baseline identical 248,019 (same file)

4. Systemic, not a 1.3.14 regression.
bun-darwin-x64 == bun-darwin-x64-baseline at 1.2.20 as well.

5. Confirmed on real pre-AVX2 hardware.
On a rented Sandy Bridge Xeon (AVX + SSE4.2, no AVX2/FMA), the AVX2 build — once it touches the simdutf text-processing path — crashes with a segfault after ~21s / ~3.9 GB RSS. The real SSE4.2 baseline build runs fine on the same machine. So the AVX2 build is what crashes, and a proper darwin baseline would work.

Root cause

The baseline WebKit prebuilt doesn't exist for macOS

From scripts/build/deps/webkit.ts:

"Baseline WebKit artifacts (-march=nehalem, /arch:SSE2 ICU) exist for Linux amd64 (glibc + musl) and Windows amd64. No baseline variant for arm64 or macOS."

bun links a prebuilt WebKit, so with no macOS baseline WebKit there's no macOS baseline bun.

For arm64 that's correct — there's no AVX on arm64, so baseline is x64-only. macOS x64 looks like it got grouped in by accident.

The knock-on effects

  • .buildkite/ci.mjs buildPlatforms has no darwin baseline lane (linux has one).
  • packages/bun-release/src/platform.ts:41 still declares the bun-darwin-x64-baseline npm package, so it publishes anyway — fed the default binary.
  • prebuiltSuffix() already appends -baseline for any x64 target, so bun's URL was always right. Only the artifact was missing.

Fix

I've built the missing artifact and confirmed it works.

Using oven-sh/WebKit's own unmodified macos-cross-release.sh with MACOS_ARCH=x86_64 MARCH_FLAG="-march=nehalem", the baseline macOS WebKit builds cleanly:

libJavaScriptCore.a AVX2 (%ymm)
-march=nehalem (this build) 0
existing bun-webkit-macos-amd64 (-march=haswell) 58,967

So it's two small changes, both mirroring lanes that already exist:

  1. oven-sh/WebKit — add a bun-webkit-macos-amd64-baseline lane (+ forward MARCH_FLAG): macOS: build a baseline (non-AVX2) x64 WebKit WebKit#290
  2. oven-sh/bun — add { os: "darwin", arch: "x64", baseline: true, … } to buildPlatforms, and correct the now-stale comment: macOS: build a real darwin-x64 baseline #34207 (draft, gated on the WebKit PR)

Prebuilt artifacts from this recipe (a baseline bun + an opencode compiled against it), if anyone with a pre-AVX2 Mac wants to test: https://github.com/tobocop2/opencode-bun-pre-avx2-mac

Activity

  1. github-actions commented on Jul 15, 2026

    @github-actions
    Contributor

    Found 2 possible duplicate issues:

    1. bun-darwin-x64-baseline crashes with SIGILL on Ivy Bridge CPUs due to BMI2 instructions #32511
    2. Illegal Instruction in macOS intel without AVX2 #26872

    This issue will be automatically closed as a duplicate in 3 days.

    • If your issue is a duplicate, please close it and 👍 the existing issue instead
    • To prevent auto-closure, add a comment or 👎 this comment

    🤖 Generated with Claude Code

  2. robobun commented on Jul 15, 2026

    @robobun
    Collaborator

    ✅ Confirmed: @oven/bun-darwin-x64-baseline 1.3.14 is byte-identical to the AVX2 default; root cause is the missing bun-webkit-macos-amd64-baseline prebuilt. Issue closed as duplicate of #32511.

    Fix tracked on oven-sh/WebKit#290 (baseline + baseline-lto macOS WebKit lanes, artifacts verified AVX-free via the preview build on oven-sh/WebKit#291) and #34207 (the bun-darwin-x64-baseline CI lane + WEBKIT_VERSION bump once the WebKit side merges).

  3. tobocop2 commented on Jul 15, 2026

    @tobocop2
    Author

    Closing as a duplicate of #32511 (and #26872), which reported this first — the auto-triage bot was right.

    Leaving the root-cause analysis here for reference, but the fix work is tracked on those:

    Builds for anyone with a pre-AVX2 Mac willing to test: https://github.com/tobocop2/opencode-bun-pre-avx2-mac

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions