Folks: Let's get Claude Code native installer working for FreeBSD

LOL - When you "buy" something you usually know what you are paying for :cool:

This seems like putting out a lot of money up front and then reaching into the "mystery bag" to see what you get.
and sometimes what you get is AI psychosis, which, big deal, talk to us long enough and we'll make you go psychotic for free
 
LOL - When you "buy" something you usually know what you are paying for :cool:

This seems like putting out a lot of money up front and then reaching into the "mystery bag" to see what you get.

Well, I'm in there. Cover me.

I am moderately miffed that they effectively restrict my choice of IDE. If I use one of their UIs or Visual Studio then I can run off the monthly plan. If I want Emacs I have to use their API plan.
 
Well, I'm in there. Cover me.

I am moderately miffed that they effectively restrict my choice of IDE. If I use one of their UIs or Visual Studio then I can run off the monthly plan. If I want Emacs I have to use their API plan.
Explain. Wouldn't you just run CC in the emacs-terminal-client? Use the @ and ! glyphs in CC to do those sorts of things. When you need to edit, edit? I don't use emacs, but would be happy to help.
 
Explain. Wouldn't you just run CC in the emacs-terminal-client? Use the @ and ! glyphs in CC to do those sorts of things. When you need to edit, edit? I don't use emacs, but would be happy to help.

I was too brief in my post. Yes, you can run claude code in emacs terminal.

But I was talking about gptel, which is its own interface for integrating LLMs with Emacs, and to use it with Anthropic you have to use the API. https://github.com/karthink/gptel

That is different in VSCode where Anthropic offers a binary module for it that uses the Claude Pro monthly account.
 
Latest status as of today for Claude Code on FreeBSD, as per https://github.com/anthropics/claude-code/issues/30640#issuecomment-4227236808:

Hey folks, a couple updates on where we are with Claude Code on FreeBSD:
  • Starting with Claude Code 2.1.101, you can run Claude Code under Linuxulator with this additional env var:
    Code:
    BUN_JSC_useBBQJIT=0 claude
  • Regarding a native FreeBSD build - a proper port means getting Bun building on FreeBSD. We're not quite there yet, but would like to get there in the future. For now you'll have to rely on Linuxulator.
 
So they want to support FreeBSD but it has to go through bun. As someone there said, "Now we have two problems."
They act all nice to us but then we have to do the work. They won't. So they're thumbing their nose at us.
 
So they want to support FreeBSD but it has to go through bun. As someone there said, "Now we have two problems."
They act all nice to us but then we have to do the work. They won't. So they're thumbing their nose at us.
Why does something even needs to be installed? Does it work offline? I see a closed web application...
 
What is Bun and why is it hard to port?

ETA: OK, some Javascript runtime and bundler. If it runs in Linuxulator it is probably not too hard to port. Doesn't mean it would be quick.
 
What is Bun and why is it hard to port?

ETA: OK, some Javascript runtime and bundler. If it runs in Linuxulator it is probably not too hard to port. Doesn't mean it would be quick.
The BUN (Blood Urea Nitrogen) test measures the level of nitrogenous urea in the blood to assess kidney function and hydration, helping to diagnose kidney disease, dehydration, or liver problems.
🤣
I am sorry
 
What is Bun and why is it hard to port?

ETA: OK, some Javascript runtime and bundler. If it runs in Linuxulator it is probably not too hard to port. Doesn't mean it would be quick.
The Anthropic guy said this:
to be upfront - porting Bun to FreeBSD is nontrivial to get right, and we're not planning to keep the (deprecated since January) JS build around.
So in my mind that's saying: "We're not going to support FreeBSD."
 
I asked about Bun support a few times with FreeBSD for a game (they switched from Node); this seems to be the main request thread: https://github.com/oven-sh/bun/issues/1524

Node ran under Wine on FreeBSD, but I couldn't figure out Bun (I'm thinking running it through winecmd to force Windows paths might do something different)



I've heard of Deno and another Js runtime; Node and Deno support BSD but I'm not sure how Bun's appealing with no BSD support (there was also some odd ticket with Bun about Windows metadata randomly disappearing on CIs)
 
Why can't the AI figure out how to do a port of itself?
Claude Code is written TypeScript, which transpiles to JavaScript and is packaged with the JavaScript Core runtime.

From Claude:
Claude Code is completely unusable on FreeBSD because all bash commands hang indefinitely. The root cause is that FreeBSD platform binaries are missing from the bundled distribution — specifically, bundled tools like ripgrep ship binaries for macOS, Linux, and Windows, but there's no x64-freebsd variant.
 
As a workaround for the lack of native support at the moment, and the manual setup/management required was annoying me, I've knocked up a shell script to manage Claude Code running under Linuxulator, tested on arm64 and aarch64 (under QEMU, not got a native host to test on at the moment) on 15.0p5 and latest 14.4/14.3 in VMs and jails. It's not a perfect solution, but will cleanly uninstall itself with a built-in command when we (hopefully) get the native port. Fairly heavily battle tested on the native installs and checks for common areas where you can shoot yourself in the foot, seems to work fine in jails too. Had Claude Code do the heavy lifting for me, but I've sanity checked it myself. Requires Linuxulator running and one of the Rocky/CentOS bases installed and configured correctly, included all the info required on the README, but it's mostly following the same info that's in the handbook, with a couple of extra notes.


Hopefully it'll make life easier for folk while we're stuck in the current situation, any feedback is welcome.
 
As a workaround for the lack of native support at the moment, and the manual setup/management required was annoying me, I've knocked up a shell script to manage Claude Code running under Linuxulator, tested on arm64 and aarch64 (under QEMU, not got a native host to test on at the moment) on 15.0p5 and latest 14.4/14.3 in VMs and jails. It's not a perfect solution, but will cleanly uninstall itself with a built-in command when we (hopefully) get the native port. Fairly heavily battle tested on the native installs and checks for common areas where you can shoot yourself in the foot, seems to work fine in jails too. Had Claude Code do the heavy lifting for me, but I've sanity checked it myself. Requires Linuxulator running and one of the Rocky/CentOS bases installed and configured correctly, included all the info required on the README, but it's mostly following the same info that's in the handbook, with a couple of extra notes.


Hopefully it'll make life easier for folk while we're stuck in the current situation, any feedback is welcome.

Installing Claude Code on FreeBSD 13​

Installing Dependencies inside the Jail​

pkg update
pkg install -y bash curl ca_root_nss linux_base-rl9


Mount the required filesystems: (MAIN root)

Set the jail path:
set J = /jails/www # MY Path !!!!
Create the required Linux compatibility directories:

mkdir -p $J/compat/linux/dev/fd
mkdir -p $J/compat/linux/dev/shm
mount -t devfs devfs $J/compat/linux/dev
mount -t linprocfs linproc $J/compat/linux/proc
mount -t linsysfs linsys $J/compat/linux/sys
mount -t fdescfs -o linrdlnk fdesc $J/compat/linux/dev/fd
mount -t tmpfs -o mode=1777 tmpfs $J/compat/linux/dev/shm

/etc/fstab​

Add the following entries to /etc/fstab on the host system: ( if need :)
devfs /jails/www/compat/linux/dev devfs rw,late 0 0
linprocfs /jails/www/compat/linux/proc linprocfs rw,late 0 0
linsysfs /jails/www/compat/linux/sys linsysfs rw,late 0 0
fdesc /jails/www/compat/linux/dev/fd fdescfs rw,linrdlnk,late 0 0
tmpfs /jails/www/compat/linux/dev/shm tmpfs rw,mode=1777,late 0 0

Check That​

Inside the jail, run:
ls -la /compat/linux/dev/fd/0
Important: the output must show a symlink, for example:
/dev/pts/1
or:
/dev/null
It must not show a character device. If it does, the installer will not work.

Bypassing the OS Check with a Fake​

The Anthropic installer refuses to run when it detects FreeBSD. To work around this, create a wrapper script that makes the system appear as Linux.

To avoid EOF parsing errors in csh, use the standard sh shell.

Enter /bin/sh:
/bin/sh
Then run the following block:

mkdir -p /tmp/fakebin
cat > /tmp/fakebin/uname <<'FAKEEOF'
#!/bin/sh
case "$1" in
-s) echo "Linux" ;;
-m) echo "x86_64" ;;
-sm|-ms) echo "Linux x86_64" ;;
-r) echo "5.15.0" ;;
-o) echo "GNU/Linux" ;;
-a) echo "Linux fakehost 5.15.0 x86_64 GNU/Linux" ;;
*) /usr/bin/uname "$@" ;;
esac
FAKEEOF
chmod +x /tmp/fakebin/uname
exit

Downloading and Installing Claude Code inside the Jail​

Download the original installer and run it with the fake uname placed at the beginning of the PATH variable:

mkdir -p /tmp/claude-install && cd /tmp/claude-install
curl -fsSL https://claude.ai/install.sh -o claude-install.sh

Run the installer with the modified environment:
env PATH="/tmp/fakebin:$PATH" /usr/local/bin/bash ./claude-install.sh

Debugging if Needed​

If the installer exits silently, run it with tracing enabled.
Since you are using csh, the syntax for redirecting output streams should be:
env PATH="/tmp/fakebin:$PATH" /usr/local/bin/bash -x ./claude-install.sh >& /tmp/ci.log
tail -60 /tmp/ci.log

Checking the Installed Version​

Run: #claude -v
2.1.175 (Claude Code)
Victory !!!

PS: Antigravity 2 is installed using the same method.
 
Back
Top