2026-01-12 02:00:09 +00:00
---
summary: "How the installer scripts work (install.sh + install-cli.sh), flags, and automation"
read_when:
2026-01-31 13:57:35 +01:00
- You want to understand `openclaw.ai/install.sh`
2026-01-12 02:00:09 +00:00
- You want to automate installs (CI / headless)
- You want to install from a GitHub checkout
2026-01-31 16:04:03 -05:00
title: "Installer Internals"
2026-01-12 02:00:09 +00:00
---
# Installer internals
2026-01-30 03:15:10 +01:00
OpenClaw ships two installer scripts (served from `openclaw.ai` ):
2026-01-12 02:00:09 +00:00
2026-01-31 13:57:35 +01:00
- `https://openclaw.ai/install.sh` — “recommended” installer (global npm install by default; can also install from a GitHub checkout)
- `https://openclaw.ai/install-cli.sh` — non-root-friendly CLI installer (installs into a prefix with its own Node)
2026-01-31 21:13:13 +09:00
- `https://openclaw.ai/install.ps1` — Windows PowerShell installer (npm by default; optional git install)
2026-01-12 02:00:09 +00:00
To see the current flags/behavior, run:
```bash
2026-01-31 13:57:35 +01:00
curl -fsSL https://openclaw.ai/install.sh | bash -s -- --help
2026-01-12 02:00:09 +00:00
```
2026-01-18 18:26:20 +00:00
Windows (PowerShell) help:
```powershell
2026-01-30 03:15:10 +01:00
& ([scriptblock]::Create((iwr -useb https://openclaw.ai/install.ps1))) -?
2026-01-18 18:26:20 +00:00
```
2026-01-30 03:15:10 +01:00
If the installer completes but `openclaw` is not found in a new terminal, it’ s usually a Node/npm PATH issue. See: [Install ](/install#nodejs--npm-path-sanity ).
2026-01-16 23:10:10 +00:00
2026-01-12 02:00:09 +00:00
## 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:
2026-01-30 03:15:10 +01:00
- `npm` (default): `npm install -g openclaw@latest`
2026-01-12 02:00:09 +00:00
- `git` : clone/build a source checkout and install a wrapper script
2026-01-30 19:22:32 +00:00
- On Linux: avoid global npm permission errors by switching npm's prefix to `~/.npm-global` when needed.
2026-01-30 03:15:10 +01:00
- If upgrading an existing install: runs `openclaw doctor --non-interactive` (best effort).
- For git installs: runs `openclaw doctor --non-interactive` after install/update (best effort).
2026-01-12 04:24:46 +00:00
- Mitigates `sharp` native install gotchas by defaulting `SHARP_IGNORE_GLOBAL_LIBVIPS=1` (avoids building against system libvips).
2026-01-31 21:13:13 +09:00
If you _want_ `sharp` to link against a globally-installed libvips (or you’ re debugging), set:
2026-01-12 04:24:46 +00:00
```bash
2026-01-31 13:57:35 +01:00
SHARP_IGNORE_GLOBAL_LIBVIPS=0 curl -fsSL https://openclaw.ai/install.sh | bash
2026-01-12 04:24:46 +00:00
```
2026-01-12 02:00:09 +00:00
### Discoverability / “git install” prompt
2026-01-30 03:15:10 +01:00
If you run the installer while **already inside a OpenClaw source checkout** (detected via `package.json` + `pnpm-workspace.yaml` ), it prompts:
2026-01-12 02:00:09 +00:00
- update and use this checkout (`git` )
- or migrate to the global npm install (`npm` )
2026-01-30 03:15:10 +01:00
In non-interactive contexts (no TTY / `--no-prompt` ), you must pass `--install-method git|npm` (or set `OPENCLAW_INSTALL_METHOD` ), otherwise the script exits with code `2` .
2026-01-12 02:00:09 +00:00
### Why Git is needed
Git is required for the `--install-method git` path (clone / pull).
2026-01-31 21:13:13 +09:00
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.
2026-01-12 02:00:09 +00:00
### Why npm hits `EACCES` on fresh Linux
2026-01-30 19:22:32 +00:00
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.
2026-01-12 02:00:09 +00:00
`install.sh` mitigates this by switching the prefix to:
- `~/.npm-global` (and adding it to `PATH` in `~/.bashrc` / `~/.zshrc` when present)
## install-cli.sh (non-root CLI installer)
2026-01-30 03:15:10 +01:00
This script installs `openclaw` into a prefix (default: `~/.openclaw` ) 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.
2026-01-12 02:00:09 +00:00
Help:
```bash
2026-01-31 13:57:35 +01:00
curl -fsSL https://openclaw.ai/install-cli.sh | bash -s -- --help
2026-01-12 02:00:09 +00:00
```
2026-01-18 18:26:20 +00:00
## install.ps1 (Windows PowerShell)
What it does (high level):
- Ensure Node.js **22+** (winget/Chocolatey/Scoop or manual).
- Choose install method:
2026-01-30 03:15:10 +01:00
- `npm` (default): `npm install -g openclaw@latest`
2026-01-18 18:26:20 +00:00
- `git` : clone/build a source checkout and install a wrapper script
2026-01-30 03:15:10 +01:00
- Runs `openclaw doctor --non-interactive` on upgrades and git installs (best effort).
2026-01-18 18:26:20 +00:00
Examples:
```powershell
2026-01-30 03:15:10 +01:00
iwr -useb https://openclaw.ai/install.ps1 | iex
2026-01-18 18:26:20 +00:00
```
```powershell
2026-01-30 03:15:10 +01:00
iwr -useb https://openclaw.ai/install.ps1 | iex -InstallMethod git
2026-01-18 18:26:20 +00:00
```
```powershell
2026-01-30 03:15:10 +01:00
iwr -useb https://openclaw.ai/install.ps1 | iex -InstallMethod git -GitDir "C:\\openclaw"
2026-01-18 18:26:20 +00:00
```
Environment variables:
2026-01-30 03:15:10 +01:00
- `OPENCLAW_INSTALL_METHOD=git|npm`
- `OPENCLAW_GIT_DIR=...`
2026-01-18 18:26:20 +00:00
Git requirement:
If you choose `-InstallMethod git` and Git is missing, the installer will print the
Git for Windows link (`https://git-scm.com/download/win` ) and exit.
2026-01-25 05:48:18 +00:00
Common Windows issues:
- **npm error spawn git / ENOENT**: install Git for Windows and reopen PowerShell, then rerun the installer.
2026-01-30 03:15:10 +01:00
- **"openclaw" is not recognized**: your npm global bin folder is not on PATH. Most systems use
2026-01-25 05:48:18 +00:00
`%AppData%\\npm` . You can also run `npm config get prefix` and add `\\bin` to PATH, then reopen PowerShell.