[FEATURE] Ship a FreeBSD native binary — Bun no longer a blocker

Status Open
Maintainer reply None cached
Activity 5 comments · opened Jul 27, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

First — thank you for keeping the npm package updated alongside the native installer. That's made it possible for FreeBSD users to keep using Claude Code.

That said, the FreeBSD installation story is still rough. The native installer doesn't recognize FreeBSD, and the npm path — while functional — is deprecated and can be unintentionally broken by the auto-updater (#51833). The community has been working around this with the Linuxulator and a FreeBSD port, but those workarounds are fragile and tend to break across releases.

The good news is that the landscape has changed significantly since the last discussion in #30640. The technical blocker identified there — that Bun didn't support FreeBSD — has been resolved:

  • oven-sh/bun#29676 merged FreeBSD cross-compilation support on April 26, 2026
  • Bun v1.3.14 (May 13, 2026) shipped official FreeBSD builds for both x64 and aarch64
  • Bun is now in the FreeBSD ports tree as lang/bun
  • Claude Code already bundles Bun 1.4.0, which is newer than the release that added FreeBSD support

bun build --compile can now target x86_64-unknown-freebsd and aarch64-unknown-freebsd, producing the same kind of self-contained single-file executable that Claude Code ships for Linux and macOS. This means a native FreeBSD binary is now technically feasible using the existing build pipeline.

Proposed Solution

Add freebsd-x64 as a build target in Claude Code's release pipeline:

  1. Add a bun build --compile --target=bun-freebsd-x64 step to CI
  2. Publish the binary as @anthropic-ai/claude-code-freebsd-x64 (following the existing per-platform optional dependency pattern)
  3. Update the native installer script (claude.ai/install.sh) to detect FreeBSD and pull the correct binary
  4. Add freebsd-x64 to the PLATFORMS map in postinstall so the npm path recognizes it too

This would bring FreeBSD in line with the existing Linux and macOS targets using the same toolchain — no new runtime dependencies, no special-casing.

Alternative Solutions

The community has found some workarounds, but they each have significant downsides:

  • Linuxulator — runs the Linux binary under FreeBSD's compatibility layer with BUN_JSC_useBBQJIT=0. It works, but requires loading linux64.ko, installing a Linux userland (/compat/linux), and disabling the BBQ JIT — a lot of system-level setup for a single tool.
  • FreeBSD ports (misc/claude-code) — a community-maintained port that bundles cli.js and vendored binaries. Unfortunately the auto-updater can overwrite this installation mid-session with the npm wrapper, which doesn't support FreeBSD (#51833). The DISABLE_AUTOUPDATER=1 workaround helps but is undocumented.
  • Pin to v2.1.112 — the last npm version with a Node.js fallback, but that means missing out on new features and improvements.

A native binary would give FreeBSD users a first-class path and let the community stop maintaining workarounds.

Priority

High - Significant impact on productivity

Feature Category

CLI commands and flags

Use Case Example

A developer on FreeBSD 15.0-RELEASE runs:

curl -fsSL https://claude.ai/install.sh | bash
  1. The installer detects uname -s = FreeBSD and downloads the freebsd-x64 binary
  2. It places the binary in ~/.claude/bin/claude
  3. Claude Code starts natively — no Linuxulator, no Linux userland, no JIT workaround flags
  4. Auto-updates pull the FreeBSD binary without conflicting with ports or npm

This would save FreeBSD users from maintaining fragile workaround stacks and let them focus on actually using the tool.

Additional Context

Why this isn't a duplicate: The prior FreeBSD issues were all closed against a specific technical blocker — Bun's lack of FreeBSD support. That blocker has since been resolved, which is why this is a new request rather than a re-opening. Here's the full timeline for context:

| Date | Event |
|------|-------|
| Oct 2025 | #10673 — FreeBSD bash commands hang (v2.0.29). Closed as not planned. |
| Feb 2026 | #29374 — FreeBSD support request. Closed as duplicate. |
| Mar 2026 | #30640 — Native installer doesn't work on FreeBSD. 60+ comments, 74 👍. Blocker identified: no Bun-on-FreeBSD. |
| Apr 2026 | #51020 — v2.1.113 drops Node.js fallback, explicitly rejects freebsd-x64. |
| Apr 2026 | #51833 — Auto-updater overwrites FreeBSD ports install. |
| Apr 26, 2026 | oven-sh/bun#29676 merges FreeBSD cross-compilation |
| May 7, 2026 | #30640 closed |
| May 13, 2026 | Bun v1.3.14 ships with FreeBSD builds |
| Jul 2026 | Bun available in FreeBSD ports tree as lang/bun |
| Jul 2026 | Claude Code bundles Bun 1.4.0 — FreeBSD-capable |

View original on GitHub ↗

4 Comments

mmenefee · 1 month ago

The deprecated-npm-path-plus-auto-updater problem you describe is exactly the fragility worth acting on — a supported install shouldn't hinge on a path that can silently break underneath you.

The one link worth making is #30640, the canonical FreeBSD thread. It was closed as COMPLETED specifically on the premise that Bun-on-FreeBSD (oven-sh/bun#1524) was the hard blocker. Your issue documents that that premise no longer holds — Bun 1.3.14 shipped FreeBSD builds and Claude Code already bundles 1.4.0 — so this reads less like a fresh request and more like grounds to revisit that closure. Worth cross-linking so maintainers see the technical basis for the original decision has changed.

(Not tagging the telemetry issue here — that one's about platform-string mislabeling, which is unrelated to the native-build question you're raising.)

elliejs · 1 month ago
The deprecated-npm-path-plus-auto-updater problem you describe is exactly the fragility worth acting on — a supported install shouldn't hinge on a path that can silently break underneath you. The one link worth making is #30640, the canonical FreeBSD thread. It was closed as COMPLETED specifically on the premise that Bun-on-FreeBSD (oven-sh/bun#1524) was the hard blocker. Your issue documents that that premise no longer holds — Bun 1.3.14 shipped FreeBSD builds and Claude Code already bundles 1.4.0 — so this reads less like a fresh request and more like grounds to revisit that closure. Worth cross-linking so maintainers see the technical basis for the original decision has changed. (Not tagging the telemetry issue here — that one's about platform-string mislabeling, which is unrelated to the native-build question you're raising.)

Yes, that issue is closed and locked and so I cannot comment on it. It is referenced in this issue. Thank you for bringing it up again so it's more visible.

This is a continuation of that issue chain, and I hope it retains the momentum.

Getting native FreeBSD support would be great.

In the meantime, the node-npm version has stopped updating, so if you don't use the linuxulator on FreeBSD you're stuck on Opus 4.6 and no auto-mode features.

mmenefee · 1 month ago
In the meantime, the node-npm version has stopped updating, so if you don't use the linuxulator on FreeBSD you're stuck on Opus 4.6 and no auto-mode features.

Can confirm, and worth adding a data point in the other direction: we've been running Claude Code under Linuxulator on FreeBSD for months without a single issue. Primary dev host is FreeBSD 15.0-RELEASE-p9 with linux_base-rl9, currently on 2.1.219, and we've tracked releases from 2.1.154 → 2.1.204 → 2.1.219 that way. I'm typing this comment in a session running exactly that setup. Interactive TUI, headless -p, and nested subagents several levels deep all work — it hasn't been a degraded experience, just a manually-upgraded one.

The path that keeps you on the latest release is to skip the npm wrapper entirely and pull the linux-x64 native binary directly. The wrapper is the part that's broken for us — it resolves a per-platform optional dependency, and @anthropic-ai/claude-code-freebsd-x64 is still unpublished (404 as of today), so npm i -g lays down a stub that dies with "native binary not installed." The linux-x64 package underneath it is current (2.1.220 today) and is a Bun single-file executable that runs unmodified under Linuxulator.

Setup (once):

sysrc linux_enable=YES
service linux start          # loads linux64.ko + linux_common.ko
pkg install linux_base-rl9   # provides /lib64/ld-linux-x86-64.so.2 and glibc

Install / upgrade (repeat per release):

VER=$(npm view @anthropic-ai/claude-code version)
npm pack @anthropic-ai/claude-code-linux-x64@$VER
tar xf anthropic-ai-claude-code-linux-x64-$VER.tgz
./package/claude --version    # sanity check under Linuxulator BEFORE installing

sudo install -m 755 package/claude /usr/local/libexec/claude-code/claude-$VER

Then point a one-line shim at it:

# /usr/local/bin/claude
#!/bin/sh
exec /usr/local/libexec/claude-code/claude-2.1.219 "$@"

Two things worth flagging against the workaround costs listed in the issue body:

BUN_JSC_useBBQJIT=0 is no longer needed. That was necessary when ant-kurt posted it in #30640, but current binaries run with no JIT flags at all. We dropped it around 2.1.154 and nothing has regressed across the three upgrades since.

The auto-updater conflict in #51833 goes away structurally with this layout. The binary lives at a versioned path under libexec and /usr/local/bin/claude is a shim you own, so there's nothing for the updater or a ports install to overwrite mid-session — you're not sharing a filename with either of them. The previous version stays on disk, so rollback is one sudo cp of the old shim. No DISABLE_AUTOUPDATER=1, no fighting misc/claude-code over the same inode.

The honest tradeoff is the one you're already arguing: the upgrade step is manual, because claude update and install.sh still have no FreeBSD path. That's exactly why the native target matters — this is a stable workaround, not a substitute. But it does mean nobody has to sit on an old release while waiting for it.

One more item for your timeline table, since it strengthens the "npm side is already half-wired for this" angle: freebsd-x64 and freebsd-arm64 have been present in the PLATFORMS map in both install.cjs and cli-wrapper.cjs for months. What's missing is a published package for them to resolve to.

elliejs · 20 days ago

bumping this to keep it from going necro

Showing cached comments. Read the full discussion on GitHub ↗