Mac如何安装openclaw
一、npm安装
(如果不知道是否安装,可以用下面的命令查看自己的版本)
npm -v二、node.js安装
(注意:版本必须是22.00以上,可以检查自己的版本)
node -v三、安装openclaw
1、先卸载旧版(如有):
npm uninstall -g openclaw2、命令安装:
sudo npm i -g openclaw 输入完后,会让你输入自己的密码(密码是不显示的,直接输入然后回车即可)。
成功安装提示:
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
npm warn deprecated [email protected]: Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
npm warn deprecated [email protected]: Use your platform's native DOMException instead
npm warn deprecated [email protected]: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting [email protected]
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
added 711 packages in 4m
130 packages are looking for funding
run `npm fund` for details

注意事项:可能出现的两种错误
1、输入:npm uninstall -g openclaw,出现如图错误:
npm error code 128
npm error An unknown git error occurred
npm error command git --no-replace-objects ls-remote ssh://[email protected]/whiskeysockets/libsignal-node.git
npm error fatal: unable to access 'https://github.com/whiskeysockets/libsignal-node.git/': Failed to connect to github.com port 443 after 75023 ms: Couldn't connect to server
npm error A complete log of this run can be found in: /Users/mac/.npm/_logs/2026-02-28T05_46_11_305Z-debug-0.log
解决方案,输入修改 Git 下载协议 (强制使用 HTTPS),复制下方代码到终端,回车执行即可解决;
再输入
2、输入:npm install -g openclaw-cn@latest,出现如图错误,因为没有权限,需要用sudo
npm error code EACCES
npm error syscall mkdir
npm error path /usr/local/lib/node_modules/openclaw-cn
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/openclaw-cn'
npm error at async mkdir (node:internal/fs/promises:856:10)
npm error at async /usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:576:20
npm error at async Promise.allSettled (index 0)
npm error at async [reifyPackages] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:313:11)
npm error at async Arborist.reify (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:125:5)
npm error at async Install.exec (/usr/local/lib/node_modules/npm/lib/commands/install.js:150:5)
npm error at async Npm.exec (/usr/local/lib/node_modules/npm/lib/npm.js:208:9)
npm error at async module.exports (/usr/local/lib/node_modules/npm/lib/cli/entry.js:67:5) {
npm error errno: -13,
npm error code: 'EACCES',
npm error syscall: 'mkdir',
npm error path: '/usr/local/lib/node_modules/openclaw-cn'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It is likely you do not have the permissions to access this file as the current user
npm error
npm error If you believe this might be a permissions issue, please double-check the
npm error permissions of the file and its containing directories, or try running
npm error the command again as root/Administrator.
npm error A complete log of this run can be found in: /Users/mac/.npm/_logs/2026-02-28T05_25_31_926Z-debug-0.log
解决方案,没有权限,npm前面加上sudo
3、检查是否安装成功
openclaw --version
可以查看到版本号,即安装成功。
4、初始化向导
openclaw onboard 
这一步主要是提醒你,使用 OpenClaw 可能会有一些风险。请问你是否继续?按向左方向键 ←,选择 Yes,按 Enter 回车确认
5、快速开始
选择选择 QiuickStart(快速开始模式),回车

6、配置模型
这里是配置 AI 模型 API Key,OpenClaw 需要连接到大语言模型才能工作。Openclaw 比较费 token,国外模型成本较高,我选的千问;

7、默认模型选择

8、选择聊天工具
可以「暂时跳过」,选择到最后skip for now,先在终端(Terminal)里把 OpenClaw 跑起来,确认它的 AI 大脑、文件读写权限都正常工作,后面再单独部署;

9、选择技能
这里选择「Yes」,也可以暂不配置选择「No」,后面通过UI界面再进行配置;

10、技能选择
点击空格,选择技能后回车。关于技能,你可以先跳过选择此步骤,或者使用空格键您需要的技能,可多选;

注意事项:出现please select at least one option
解决方案:点击空格,选择技能后回车。

11、配置备用API
这里可以配置备用 API,如果不想配置就都选「No」即可;

12、配置hooks

13、启动服务
正在完成最后的启动服务配置,大约30秒左右;

14、安装成功

我这个是页面启动失败,可以在浏览器输入:http://127.0.0.1:18789 http://127.0.0.1:18789 http://127.0.0.1:18789
注意事项:
打开http://127.0.0.1:18789 链接出现 unauthorized: gateway token mismatch (open the dashboard URL and paste the token in Control UI settings)错误;
解决办法:
1、先找到openclaw.json文件;
2、找到gateway>auth>token,复制token值;
3、在概览的“网关令牌”添加令牌值,即上面复制的值;
4、重启网关;
5、打开:http://127.0.0.1:18789/?token=这是令牌值 即可,比如令牌是abc123,那打开链接就是http://127.0.0.1:18789/?token=abc123