Installer internals
Clawdbot ships two installer scripts (served fromclawd.bot):
https://clawd.bot/install.sh— “recommended” installer (global npm install by default; can also install from a GitHub checkout)https://clawd.bot/install-cli.sh— non-root-friendly CLI installer (installs into a prefix with its own Node)
install.sh (recommended)
What it does (high level):- Detect OS (macOS / Linux / WSL).
- Ensure Node.js 22+ (macOS via Homebrew; Linux via NodeSource).
- Choose install method:
npm(default):npm install -g clawdbot@latestgit: clone/build a source checkout and install a wrapper script
- On Linux: avoid global npm permission errors by switching npm’s prefix to
~/.npm-globalwhen needed. - If upgrading an existing install: runs
clawdbot doctor --non-interactive(best effort). - Mitigates
sharpnative install gotchas by defaultingSHARP_IGNORE_GLOBAL_LIBVIPS=1(avoids building against system libvips).
sharp to link against a globally-installed libvips (or you’re debugging), set:
Discoverability / “git install” prompt
If you run the installer while already inside a Clawdbot source checkout (detected viapackage.json + pnpm-workspace.yaml), it prompts:
- update and use this checkout (
git) - or migrate to the global npm install (
npm)
--no-prompt), you must pass --install-method git|npm (or set CLAWDBOT_INSTALL_METHOD), otherwise the script exits with code 2.
Why Git is needed
Git is required for the--install-method git path (clone / pull).
For npm installs, Git is usually not required, but some environments still end up needing it (e.g. when a package or dependency is fetched via a git URL). The installer currently ensures Git is present to avoid spawn git ENOENT surprises on fresh distros.
Why npm hits EACCES on fresh Linux
On some Linux setups (especially after installing Node via the system package manager or NodeSource), npm’s global prefix points at a root-owned location. Then npm install -g ... fails with EACCES / mkdir permission errors.
install.sh mitigates this by switching the prefix to:
~/.npm-global(and adding it toPATHin~/.bashrc/~/.zshrcwhen present)
install-cli.sh (non-root CLI installer)
This script installsclawdbot into a prefix (default: ~/.clawdbot) and also installs a dedicated Node runtime under that prefix, so it can work on machines where you don’t want to touch the system Node/npm.
Help:
Patches (npm / pnpm / bun)
Clawdbot’spostinstall script includes a builtin JS patcher that can apply pnpm.patchedDependencies patches even when the package manager doesn’t support them (notably Bun). pnpm itself already applies pnpm.patchedDependencies, so the fallback skips pnpm installs to avoid double-applying.
See: Bun notes.