{
  "title": "Installer internals",
  "content": "OpenClaw ships two installer scripts (served from `openclaw.ai`):\n\n* `https://openclaw.ai/install.sh` — “recommended” installer (global npm install by default; can also install from a GitHub checkout)\n* `https://openclaw.ai/install-cli.sh` — non-root-friendly CLI installer (installs into a prefix with its own Node)\n* `https://openclaw.ai/install.ps1` — Windows PowerShell installer (npm by default; optional git install)\n\nTo see the current flags/behavior, run:\n\nWindows (PowerShell) help:\n\nIf 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).\n\n## install.sh (recommended)\n\nWhat it does (high level):\n\n* Detect OS (macOS / Linux / WSL).\n* Ensure Node.js **22+** (macOS via Homebrew; Linux via NodeSource).\n* Choose install method:\n  * `npm` (default): `npm install -g openclaw@latest`\n  * `git`: clone/build a source checkout and install a wrapper script\n* On Linux: avoid global npm permission errors by switching npm's prefix to `~/.npm-global` when needed.\n* If upgrading an existing install: runs `openclaw doctor --non-interactive` (best effort).\n* For git installs: runs `openclaw doctor --non-interactive` after install/update (best effort).\n* Mitigates `sharp` native install gotchas by defaulting `SHARP_IGNORE_GLOBAL_LIBVIPS=1` (avoids building against system libvips).\n\nIf you *want* `sharp` to link against a globally-installed libvips (or you’re debugging), set:\n\n### Discoverability / “git install” prompt\n\nIf you run the installer while **already inside a OpenClaw source checkout** (detected via `package.json` + `pnpm-workspace.yaml`), it prompts:\n\n* update and use this checkout (`git`)\n* or migrate to the global npm install (`npm`)\n\nIn 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`.\n\n### Why Git is needed\n\nGit is required for the `--install-method git` path (clone / pull).\n\nFor `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.\n\n### Why npm hits `EACCES` on fresh Linux\n\nOn 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.\n\n`install.sh` mitigates this by switching the prefix to:\n\n* `~/.npm-global` (and adding it to `PATH` in `~/.bashrc` / `~/.zshrc` when present)\n\n## install-cli.sh (non-root CLI installer)\n\nThis 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.\n\n## install.ps1 (Windows PowerShell)\n\nWhat it does (high level):\n\n* Ensure Node.js **22+** (winget/Chocolatey/Scoop or manual).\n* Choose install method:\n  * `npm` (default): `npm install -g openclaw@latest`\n  * `git`: clone/build a source checkout and install a wrapper script\n* Runs `openclaw doctor --non-interactive` on upgrades and git installs (best effort).\n\nEnvironment variables:\n\n* `OPENCLAW_INSTALL_METHOD=git|npm`\n* `OPENCLAW_GIT_DIR=...`\n\nIf you choose `-InstallMethod git` and Git is missing, the installer will print the\nGit for Windows link (`https://git-scm.com/download/win`) and exit.\n\nCommon Windows issues:\n\n* **npm error spawn git / ENOENT**: install Git for Windows and reopen PowerShell, then rerun the installer.\n* **\"openclaw\" is not recognized**: your npm global bin folder is not on PATH. Most systems use\n  `%AppData%\\\\npm`. You can also run `npm config get prefix` and add `\\\\bin` to PATH, then reopen PowerShell.",
  "code_samples": [
    {
      "code": "Windows (PowerShell) help:",
      "language": "unknown"
    },
    {
      "code": "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).\n\n## install.sh (recommended)\n\nWhat it does (high level):\n\n* Detect OS (macOS / Linux / WSL).\n* Ensure Node.js **22+** (macOS via Homebrew; Linux via NodeSource).\n* Choose install method:\n  * `npm` (default): `npm install -g openclaw@latest`\n  * `git`: clone/build a source checkout and install a wrapper script\n* On Linux: avoid global npm permission errors by switching npm's prefix to `~/.npm-global` when needed.\n* If upgrading an existing install: runs `openclaw doctor --non-interactive` (best effort).\n* For git installs: runs `openclaw doctor --non-interactive` after install/update (best effort).\n* Mitigates `sharp` native install gotchas by defaulting `SHARP_IGNORE_GLOBAL_LIBVIPS=1` (avoids building against system libvips).\n\nIf you *want* `sharp` to link against a globally-installed libvips (or you’re debugging), set:",
      "language": "unknown"
    },
    {
      "code": "### Discoverability / “git install” prompt\n\nIf you run the installer while **already inside a OpenClaw source checkout** (detected via `package.json` + `pnpm-workspace.yaml`), it prompts:\n\n* update and use this checkout (`git`)\n* or migrate to the global npm install (`npm`)\n\nIn 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`.\n\n### Why Git is needed\n\nGit is required for the `--install-method git` path (clone / pull).\n\nFor `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.\n\n### Why npm hits `EACCES` on fresh Linux\n\nOn 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.\n\n`install.sh` mitigates this by switching the prefix to:\n\n* `~/.npm-global` (and adding it to `PATH` in `~/.bashrc` / `~/.zshrc` when present)\n\n## install-cli.sh (non-root CLI installer)\n\nThis 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.\n\nHelp:",
      "language": "unknown"
    },
    {
      "code": "## install.ps1 (Windows PowerShell)\n\nWhat it does (high level):\n\n* Ensure Node.js **22+** (winget/Chocolatey/Scoop or manual).\n* Choose install method:\n  * `npm` (default): `npm install -g openclaw@latest`\n  * `git`: clone/build a source checkout and install a wrapper script\n* Runs `openclaw doctor --non-interactive` on upgrades and git installs (best effort).\n\nExamples:",
      "language": "unknown"
    },
    {
      "code": "",
      "language": "unknown"
    },
    {
      "code": "",
      "language": "unknown"
    }
  ],
  "headings": [
    {
      "level": "h2",
      "text": "install.sh (recommended)",
      "id": "install.sh-(recommended)"
    },
    {
      "level": "h3",
      "text": "Discoverability / “git install” prompt",
      "id": "discoverability-/-“git-install”-prompt"
    },
    {
      "level": "h3",
      "text": "Why Git is needed",
      "id": "why-git-is-needed"
    },
    {
      "level": "h3",
      "text": "Why npm hits `EACCES` on fresh Linux",
      "id": "why-npm-hits-`eacces`-on-fresh-linux"
    },
    {
      "level": "h2",
      "text": "install-cli.sh (non-root CLI installer)",
      "id": "install-cli.sh-(non-root-cli-installer)"
    },
    {
      "level": "h2",
      "text": "install.ps1 (Windows PowerShell)",
      "id": "install.ps1-(windows-powershell)"
    }
  ],
  "url": "llms-txt#installer-internals",
  "links": []
}