Skip to content

Node.js 安装

通过 npm 全局安装 OpenClaw,适合本地开发和个人使用。支持 macOS 和 Linux。

Windows 用户

请参考 Windows 安装 页面,有更详细的图文教程。

方式一:有外网(一键安装)

macOS

bash
# 1. 安装 Node.js(通过 Homebrew)
brew install node

# 验证版本(需要 v22 以上)
node -v

# 2. 一键安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash

# 3. 初始化配置(建议加上 --install-daemon 开机自启)
openclaw onboard --install-daemon

# 4. 检查网关状态
openclaw gateway status

# 5. 打开 Dashboard
openclaw dashboard
# 或直接在浏览器访问 http://127.0.0.1:18789/

Linux

bash
# 安装 nvm + Node.js
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
nvm install 22
nvm use 22

# 一键安装 OpenClaw
curl -fsSL https://openclaw.ai/install.sh | bash

# 初始化
openclaw onboard --install-daemon

方式二:纯国内网络(手动安装)

没有外网也能安装,只需把下载源切到国内。

1. 安装 Node.js

  • macOS:从 Node.js 中文官网 下载 .pkg 安装包,双击安装
  • Linux:使用系统包管理器或 nvm 安装

2. 配置国内镜像

bash
npm config set registry https://registry.npmmirror.com

3. 安装 OpenClaw

bash
npm install -g openclaw

4. 初始化配置

bash
openclaw onboard --install-daemon

离线安装(无网络环境)

适用于内网或物理断网的 Mac/Linux 设备。

在有网的电脑上准备

bash
# 下载 Node.js 离线安装包(从 nodejs.org)
# 打包 OpenClaw 离线包
npm pack openclaw

在无网的设备上安装

bash
# 安装 Node.js 离线包
# 安装 OpenClaw 离线包
cd ~/Desktop
npm install -g ./openclaw-1.x.x.tgz

# 手动启动网关(无法在线验证时需要指定端口)
openclaw gateway --port 18789

更新 OpenClaw

bash
npm install -g openclaw@latest

卸载

bash
npm uninstall -g openclaw

下一步

基于 MIT 协议发布