Running Claude Code on FreeBSD takes a little extra setup. The approach covered here uses the Linux executable through FreeBSD’s Linux compatibility layer, commonly called Linuxulator.
The setup has three parts: enabling Linuxulator, installing Claude Code, and setting two environment variables for its bundled Bun runtime. I also include a CLAUDE.md configuration to help Claude understand that the host is FreeBSD.
These instructions cover the amd64 Linuxulator approach. FreeBSD is not an officially supported Claude Code platform, and compatibility can change between releases.
1. Enable Linuxulator
As root, install the Rocky Linux userland and enable Linux compatibility:
pkg install linux_base-rl9
sysrc linux_enable="YES"
service linux start
The linux_base-rl9 package installs the Linux userland under /compat/linux. The Linux service loads the necessary compatibility modules and mounts the filesystems Linux applications expect. Setting linux_enable enables it at boot.
You do not need a Linux virtual machine for this setup. Linuxulator lets the Linux executable run using FreeBSD’s kernel.
2. Install Claude Code
The FreeBSD Ports Collection includes misc/claude-code. If a binary package is available in your configured repository, install it as root:
pkg install claude-code
Package availability and versions depend on your FreeBSD release and package repository.
3. Configure the Bun runtime
Add these settings to ~/.shrc, or the appropriate startup file for your shell:
# for Claude
export BUN_JSC_useBBQJIT=0
export BUN_JSC_useConcurrentGC=0
For FreeBSD’s interactive sh, load the changes into your current shell:
. ~/.shrc
For Bash, use the startup file your interactive shell reads, typically ~/.bashrc. For Zsh, use ~/.zshrc. Make sure your login-shell configuration loads the relevant file when necessary.
If you use csh or tcsh, the equivalent settings are:
# for Claude
setenv BUN_JSC_useBBQJIT 0
setenv BUN_JSC_useConcurrentGC 0
What do these settings do?
BUN_JSC_useBBQJIT=0disables JavaScriptCore’s BBQ JIT tier. This setting is part of the documented upstream workaround for running Claude Code through Linuxulator.BUN_JSC_useConcurrentGC=0disables concurrent garbage collection. It has been reported to avoid a deadlock that can freeze Claude Code during a Linuxulator session.
These are internal runtime options, so they may change as Claude Code’s bundled runtime changes. They must be present in the environment before Claude Code starts. Putting them in CLAUDE.md does not configure the runtime.
Exports in your shell configuration also affect other Bun programs launched from that shell. If you want to restrict the settings to Claude Code, you can instead set them in a dedicated launcher.
4. Start Claude Code
As your regular user, check that the executable starts:
claude --version
Then launch it from your project directory:
cd /path/to/project
claude
Follow the authentication prompts. A successful version check confirms startup, but it does not establish that a full session works. Try several prompts and shell commands, then leave the session idle for a few minutes and try another command.
5. Tell Claude that the host is FreeBSD
There is an important distinction here: Claude Code is running as a Linux executable, but the host operating system is FreeBSD. Runtime platform detection can report Linux, which can lead Claude to suggest Linux-specific commands.
To provide explicit guidance, add the following to ~/.claude/CLAUDE.md for user-wide instructions, or to a project’s CLAUDE.md when the guidance should apply only to that project. Merge it with any instructions already in the file.
## Host operating system
This machine runs FreeBSD. Claude Code itself runs as a Linux
binary through FreeBSD's Linuxulator compatibility layer.
A Linux platform reported by Claude Code or its runtime describes
the executable's ABI. It does not mean the host is a Linux system.
### Shell commands and administration
- Target FreeBSD when suggesting or executing host commands.
- Use `freebsd-version` and `/usr/bin/uname -a` to check the host.
- Use `pkg` for host packages and the FreeBSD Ports Collection when
a suitable binary package is unavailable.
- Use `service` and `sysrc` for services and startup configuration.
- Expect third-party configuration under `/usr/local/etc`.
- Do not assume systemd, systemctl, apt, dnf, or Linux /proc behavior
is available on the host.
- Assume base utilities use BSD syntax. Check local manual pages
before using GNU-specific options, especially for sed, date,
stat, find, and xargs.
- Inspect installed tools and the current shell before choosing
commands or shell syntax.
### Linuxulator boundary
- `/compat/linux` contains the Linux compatibility userland.
- Keep host administration separate from Linux userland maintenance.
- Do not install Linux packages into the FreeBSD host.
- Do not assume Linux namespaces, cgroups, containers, or sandbox
features work through Linuxulator.
- For FreeBSD software development, use the host's native compiler,
headers, libraries, and build tools unless the project explicitly
targets Linux.
### Claude Code runtime settings
Launch Claude Code with these environment variables already set:
BUN_JSC_useBBQJIT=0
BUN_JSC_useConcurrentGC=0
Documenting them here does not set them in the running process.
They belong in the shell configuration or launcher.
This gives Claude useful context for choosing commands. It does not change the executable’s platform detection or guarantee that every suggested command will be appropriate.
Troubleshooting
Claude starts but freezes during a session
Confirm that both runtime variables are exported in the shell launching Claude:
env | grep '^BUN_JSC_'
You should see:
BUN_JSC_useBBQJIT=0
BUN_JSC_useConcurrentGC=0
Exit any existing Claude session and restart it after setting the variables. An already-running process will not pick up changes made to your shell environment.
The executable fails to start
Check that Linux compatibility is loaded and the Linux userland is installed:
kldstat
pkg info linux_base-rl9
ls /compat/linux
If needed, start the Linux service as root:
service linux start
Claude suggests Linux commands
Confirm that your FreeBSD instructions are in the appropriate CLAUDE.md file. Ask Claude to check the host with freebsd-version before making operating-system-specific changes.
Record your working versions
When troubleshooting or sharing results, capture the FreeBSD release, architecture, and installed package versions:
freebsd-version -ku
uname -m
pkg info claude-code linux_base-rl9
claude --version
A working configuration is tied to both the FreeBSD environment and the Claude Code runtime. Recording those versions makes future compatibility problems easier to compare.






