Auto-updater overwrites FreeBSD ports installation, breaking claude
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: yuri@FreeBSD.org) - 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.js— missing (the port's main entry point)bun.lock— missingpackage.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.platformis not in the supported PLATFORMS map - Provide a setting or environment variable to disable auto-updates entirely (the current
autoUpdatesChannelsetting 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
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗