Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Claude Code on HaikuOS

An unofficial installer that gets Anthropic's Claude Code running natively on HaikuOS, including 32-bit x86.

Nothing here is a fork or a patch. It installs the unmodified npm tarball of the last release that was still plain JavaScript, and runs it on the Node that HaikuPorts already ships.

Korean version of this document: README.ko.md.

Why the official installer cannot work

$ wget -q -O - https://claude.ai/install.sh | bash
Unsupported operating system: Haiku. See https://code.claude.com/docs for supported platforms.

https://claude.ai/install.sh downloads one native binary per platform, and the platform list is darwin-{x64,arm64}, linux-{x64,arm64} and their musl and Windows variants. There is no Haiku build, and no 32-bit build of any kind. The binary is compiled with Bun, whose x86 floor is Nehalem, so even a Linux compatibility layer would not help a 32-bit machine.

npm is not a way around it either: from v2.1.113 the npm package is a 24 KB stub whose postinstall copies one of those same native binaries into place.

What does work

Up to and including v2.1.112, @anthropic-ai/claude-code was a single bundled cli.js with no dependencies and engines: node >=18.0.0. HaikuPorts has nodejs20_x86 (Node 20.15.1). Put those two together and Claude Code runs

  • TUI, theme picker, tool calls and all.
$ node -p "process.platform + '/' + process.arch"
haiku/ia32
$ claude --version
2.1.112 (Claude Code)

Install

On the Haiku machine:

./install.sh

It installs nodejs20_x86 and ripgrep_x86 through pkgman if they are missing, unpacks Claude Code into ~/config/non-packaged/lib/claude-code, and writes a launcher to ~/config/non-packaged/bin/claude, which is already on Haiku's default PATH.

claude

First run walks you through the theme picker and then /login. Over ssh there is no browser to hand off to, so copy the login URL to another machine and paste the code back.

To remove it:

./install.sh --uninstall

Options

--version VER   Claude Code version (default: 2.1.112). Later releases are
                native-only and cannot run here.
--prefix DIR    install root (default: ~/config/non-packaged)
--no-pkgman     never call pkgman; fail if node or ripgrep is missing
--force         install even if the version asked for looks native-only
--uninstall     remove the launcher and the bundle

What the launcher sets, and why

export USE_BUILTIN_RIPGREP=0
export DISABLE_AUTOUPDATER=1
exec node ~/config/non-packaged/lib/claude-code/cli.js "$@"
  • USE_BUILTIN_RIPGREP=0 - the npm package vendors ripgrep for linux and darwin only. The installer deletes that vendor/ tree (it is ~34 MB of binaries and JetBrains jars that cannot run here, taking the install from 48 MB down to 14 MB) and points Claude Code at ripgrep_x86 instead.
  • DISABLE_AUTOUPDATER=1 - load-bearing. Without it Claude Code updates itself to 2.1.113 or later, which is the native-binary wrapper, and then nothing runs at all.

Limits

  • You are pinned to 2.1.112. There is no upgrade path while Claude Code ships as a Bun binary. Features added after that release are not here.
  • Memory is the tightest constraint. See below.
  • The base Haiku install has no curl. Claude Code does not need it, but shell commands you ask Claude to run might - pkgman install curl.
  • Tested on Haiku R1~beta6 (hrev99002), x86_gcc2, on real hardware. The installer handles x86_64 Haiku too, but that path is untested - and on x86_64 you may be better served by running the Linux binary under a compatibility layer, if you have one.

Memory, and why swap is not the answer

On a 2 GB Haiku box, measured:

Total RAM 2038 MB
Swap (Haiku default, /var/swap) 2038 MB, already enabled
Node 20 ia32 default old-space heap 522 MB
Live heap actually reachable ~1 GB, then the machine thrashes

The OOM you hit first is V8's own heap ceiling, not physical memory. When V8 reaches max-old-space-size it aborts with JavaScript heap out of memory no matter how much RAM or swap is sitting idle - the limit is self-imposed. Adding swap does not move it.

Haiku already creates a swap file the size of RAM at install time, so on most machines there is nothing to add anyway. Check with:

ls -l /var/swap

To change it, use the VirtualMemory preferences panel (it writes ~/config/settings/kernel/drivers/virtual_memory) and reboot.

What does help is raising the ceiling, which the installer now does: it sets --max-old-space-size to 40% of RAM, capped at 1024 MB, in the launcher.

==> V8 old-space limit: 814 MB

Override at install time with --heap MB (--heap 0 leaves Node's default), or per run with NODE_OPTIONS, which the launcher deliberately does not clobber:

NODE_OPTIONS=--max-old-space-size=1200 claude

Why not higher: 32-bit user address space on Haiku tops out around 2 GB, and long before that a 2 GB machine runs out of physical memory and starts paging. In a test that held live JS objects, 1 GB was reached in 21 seconds and the next 32 MB had not landed 4 minutes later. That is the point where swap does get involved - and it turns a fast crash into an unusable machine, which is not an improvement. The 40% default keeps the heap inside RAM.

License

install.sh and the documentation are MIT. See LICENSE.

Claude Code itself is not open source and is not redistributed here - the installer downloads the unmodified npm tarball at install time, and your use of it is governed by Anthropic's Commercial Terms of Service. Node.js and ripgrep come from HaikuPorts under their own licenses.

Not affiliated with or endorsed by Anthropic. Installing Claude Code this way is unsupported by its vendor.

About

An unofficial installer that gets Anthropic's Claude Code running natively on HaikuOS, including 32-bit x86.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages