claude-code - 💡(How to fix) Fix Auto-updater overwrites FreeBSD ports installation, breaking claude [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#51833Fetched 2026-04-23 07:43:45
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×3commented ×1

Claude Code's built-in auto-updater runs npm install --global @anthropic-ai/claude-code during sessions. On FreeBSD, where Claude Code is installed via the ports/pkg system (misc/claude-code), this overwrites the port's files with npm's wrapper package, which does not support FreeBSD — leaving the bin/claude.exe stub script in place of the working binary.

After exiting a session, the user cannot run claude again:

Error: claude native binary not installed.

Error Message

Error: claude native binary not installed.

Root Cause

Claude Code's built-in auto-updater runs npm install --global @anthropic-ai/claude-code during sessions. On FreeBSD, where Claude Code is installed via the ports/pkg system (misc/claude-code), this overwrites the port's files with npm's wrapper package, which does not support FreeBSD — leaving the bin/claude.exe stub script in place of the working binary.

After exiting a session, the user cannot run claude again:

Error: claude native binary not installed.

Fix Action

Workaround

After each session, reinstall the port: sudo pkg install -f claude-code. This is obviously not sustainable.

🤖 Generated with Claude Code

Code Example

Error: claude native binary not installed.

---

verbose title npm install @anthropic-ai/claude-code
verbose argv "install" "--global" "@anthropic-ai/claude-code"
...
silly reify mark retired [
  '/usr/local/lib/node_modules/@anthropic-ai/claude-code',
  '/usr/local/bin/claude'
]
...
verbose os FreeBSD 15.0-RELEASE-p5
RAW_BUFFERClick to expand / collapse

Summary

Claude Code's built-in auto-updater runs npm install --global @anthropic-ai/claude-code during sessions. On FreeBSD, where Claude Code is installed via the ports/pkg system (misc/claude-code), this overwrites the port's files with npm's wrapper package, which does not support FreeBSD — leaving the bin/claude.exe stub script in place of the working binary.

After exiting a session, the user cannot run claude again:

Error: claude native binary not installed.

Details

  • Platform: FreeBSD 15.0-RELEASE-p5 (amd64)
  • Port version: claude-code-2.1.89 (from misc/claude-code, maintainer: [email protected])
  • npm version installed by auto-updater: 2.1.117

The FreeBSD port bundles a working Node.js-based cli.js entry point and vendored binaries (ripgrep, etc.). The npm wrapper package does not include these — it only contains install.cjs and cli-wrapper.cjs, both of which reject freebsd-x64 as an unsupported platform.

Evidence from npm logs

verbose title npm install @anthropic-ai/claude-code
verbose argv "install" "--global" "@anthropic-ai/claude-code"
...
silly reify mark retired [
  '/usr/local/lib/node_modules/@anthropic-ai/claude-code',
  '/usr/local/bin/claude'
]
...
verbose os FreeBSD 15.0-RELEASE-p5

Files destroyed by the auto-update

pkg check -s claude-code after the auto-update shows:

  • cli.jsmissing (the port's main entry point)
  • bun.lock — missing
  • package.json — checksum mismatch (npm's version)
  • All vendored ripgrep and audio-capture binaries — missing

Suggested fix

The auto-updater should detect when Claude Code was installed via a system package manager (ports/pkg, apt, rpm, etc.) and skip the npm self-update. Possible detection methods:

  • Check if the installation path is owned by a package manager (pkg which, dpkg -S, etc.)
  • Check if process.platform is not in the supported PLATFORMS map
  • Provide a setting or environment variable to disable auto-updates entirely (the current autoUpdatesChannel setting only allows "latest" or "stable", not "disabled")

Workaround

After each session, reinstall the port: sudo pkg install -f claude-code. This is obviously not sustainable.

🤖 Generated with Claude Code

extent analysis

TL;DR

The most likely fix is to modify the auto-updater to detect and respect system package manager installations, skipping npm self-updates when necessary.

Guidance

  • Check the installation path to determine if it's managed by a package manager like ports/pkg, and skip the npm update if so.
  • Consider adding a setting or environment variable to allow users to disable auto-updates entirely.
  • Verify the fix by checking that the cli.js and vendored binaries are not overwritten after a session.
  • To mitigate the issue temporarily, users can reinstall the port after each session using sudo pkg install -f claude-code, although this is not a sustainable solution.

Example

No code snippet is provided as the issue does not require a specific code change, but rather a modification to the auto-updater's logic.

Notes

The provided workaround of reinstalling the port after each session is not sustainable and highlights the need for a proper fix to the auto-updater.

Recommendation

Apply a workaround by modifying the auto-updater to detect system package manager installations and skip npm self-updates, as this directly addresses the root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Auto-updater overwrites FreeBSD ports installation, breaking claude [1 comments, 2 participants]