跳到主要内容

安装

除非有特殊原因,否则请使用安装程序。它会自动设置 CLI 并运行入职流程。

快速安装 (推荐)

curl -fsSL https://clawd.bot/install.sh | bash

Windows (PowerShell):

iwr -useb https://clawd.bot/install.ps1 | iex

下一步(如果您跳过了入职流程):

clawdbot onboard --install-daemon

系统要求

  • Node >=22
  • macOS、Linux 或通过 WSL2 的 Windows
  • 仅当您从源码构建时才需要 pnpm

选择安装路径

1) 安装脚本 (推荐)

通过 npm 全局安装 clawdbot 并运行入职流程。

curl -fsSL https://clawd.bot/install.sh | bash

安装程序标志:

curl -fsSL https://clawd.bot/install.sh | bash -s -- --help

详情:安装程序内部机制

非交互式(跳过入职流程):

curl -fsSL https://clawd.bot/install.sh | bash -s -- --no-onboard

2) 全局安装 (手动)

如果您已经安装了 Node:

npm install -g clawdbot@latest

如果您全局安装了 libvips(在 macOS 上通过 Homebrew 很常见)且 sharp 安装失败,请强制使用预构建的二进制文件:

SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm install -g clawdbot@latest

如果您看到 sharp: Please add node-gyp to your dependencies,要么安装构建工具(macOS: Xcode CLT + npm install -g node-gyp),要么使用上述 SHARP_IGNORE_GLOBAL_LIBVIPS=1 解决方法来跳过原生构建。

或者:

pnpm add -g clawdbot@latest

然后:

clawdbot onboard --install-daemon

3) 从源码安装 (贡献者/开发人员)

git clone https://github.com/clawdbot/clawdbot.git
cd clawdbot
pnpm install
pnpm ui:build # 首次运行时自动安装 UI 依赖
pnpm build
clawdbot onboard --install-daemon

提示:如果您还没有全局安装,请通过 pnpm clawdbot ... 运行仓库命令。

4) 其他安装选项

安装之后

  • 运行入职流程:clawdbot onboard --install-daemon
  • 快速检查:clawdbot doctor
  • 检查网关健康状况:clawdbot status + clawdbot health
  • 打开仪表板:clawdbot dashboard

安装方法:npm vs git (安装程序)

安装程序支持两种方法:

  • npm (默认): npm install -g clawdbot@latest
  • git: 从 GitHub 克隆/构建,并从源码检出运行

CLI 标志

# 显式使用 npm
curl -fsSL https://clawd.bot/install.sh | bash -s -- --install-method npm

# 从 GitHub 安装 (源码检出)
curl -fsSL https://clawd.bot/install.sh | bash -s -- --install-method git

常用标志:

  • --install-method npm|git
  • --git-dir <path> (默认: ~/clawdbot)
  • --no-git-update (使用现有检出时跳过 git pull)
  • --no-prompt (禁用提示;在 CI/自动化中必需)
  • --dry-run (打印将要发生的操作;不进行任何更改)
  • --no-onboard (跳过入职流程)

环境变量

等效的环境变量(对自动化很有用):

  • CLAWDBOT_INSTALL_METHOD=git|npm
  • CLAWDBOT_GIT_DIR=...
  • CLAWDBOT_GIT_UPDATE=0|1
  • CLAWDBOT_NO_PROMPT=1
  • CLAWDBOT_DRY_RUN=1
  • CLAWDBOT_NO_ONBOARD=1
  • SHARP_IGNORE_GLOBAL_LIBVIPS=0|1 (默认: 1; 避免 sharp 针对系统 libvips 进行构建)

故障排除:找不到 clawdbot (PATH)

快速诊断:

node -v
npm -v
npm prefix -g
echo "$PATH"

如果 $(npm prefix -g)/bin (macOS/Linux) 或 $(npm prefix -g) (Windows) 没有 出现在 echo "$PATH" 中,说明您的 shell 找不到全局 npm 二进制文件(包括 clawdbot)。

解决方法:将其添加到您的 shell 启动文件中(zsh: ~/.zshrc, bash: ~/.bashrc):

# macOS / Linux
export PATH="$(npm prefix -g)/bin:$PATH"

在 Windows 上,将 npm prefix -g 的输出添加到您的 PATH 中。

然后打开一个新的终端(或在 zsh 中运行 rehash / 在 bash 中运行 hash -r)。

更新 / 卸载