macos部署openclaw的圖文步驟
一、安裝 node
1. 安裝 node 虛擬環(huán)境
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.4/install.sh | bash
2. 配置 nvm
命令行中可以直接使用 nvm。不配置需要進入到 ~/.nvm 目錄執(zhí)行
# 將下面三行放入 .zshrc 中命令行可以直接使用 nvm 命令。 export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # 這行加載 nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # 命令補全
3. nvm 相關操作
# 查看遠程可安裝的 node 版本 nvm ls-remote
# 安裝指定版本 node nvm install v24.12.0
# 使用指定版本 nvm use v24.12.0
# 查看本地已安裝版本 nvm ls
二、安裝 openclaw
1. 使用npm安裝 openclaw
npm install -g openclaw@latest
2. 初始化 openclaw
openclaw onboard --install-daemon
這里選 yes

然后選 QuickStart

這里選擇模型,我選擇的 OpenAI

這里填寫 key 或者使用 open Codex。
我使用的是 Codex

這里會在游覽器自動打開一個 openai 的登錄頁面,登錄就行。

然后選擇模型版本。這里我要用 0011.ai 代理就選默認了。代理稍后在配置中配置。

然后選擇使用的聊天選件。我本地用就不選這個了。skip for now 跳過

然后安裝 skills。這個可以后面在安裝。

然后是安裝 hooks,這里面有幾個選項

| 選項 | 作用 | 解釋 |
|---|---|---|
| boot-md | 啟動時運行 BOOT.md 當 Gateway 啟動且內部鉤子啟用時,此鉤子會執(zhí)行工作區(qū)根目錄下的 BOOT.md 文件里的指令。 | 適合放一些啟動時需要自動執(zhí)行的任務。比如,在 BOOT.md 里寫上發(fā)送一條“我上線了”的消息,或者初始化某個服務的指令。 |
| bootstrap-extra-files | 注入額外的啟動文件 在 Agent 啟動流程 (agent:bootstrap 事件) 中,這個鉤子可以將你額外指定的文件注入到 Agent 的工作區(qū)上下文中。 | 適合讓每次對話都自動加載一些特定文件。比如一些固定的參考文檔、代碼片段等,不用每次手動/load。 |
| command-logger | 記錄所有指令日志 它會監(jiān)聽所有的命令事件,并將記錄保存到 ~/.openclaw/logs/commands.log 文件中。 | 相當于一個操作記錄員。開啟后,在 OpenClaw 里執(zhí)行過的所有命令都會被記錄下來,方便日后排查問題或審計。 |
| session-memory | 保存會話記憶 當你執(zhí)行 /new 命令開始一個新會話時,它會自動將當前會話的上下文保存到你的 Agent 工作區(qū)中。 | 可以讓OpenClaw擁有跨會話的長期記憶。即使你開啟了新對話,它也能回憶起之前聊過的重要信息,讓交互更有連續(xù)性。 |
然后他會安裝 gateway。等一會兒就行了,然后選擇使用命令行對話還是 UI 對話。建議先用 UI 里面很多信息比較清楚。

完成后會自動在游覽器打開 UI 頁面。沒打開也沒事,日志里面可以看到。自己打開就行了

現(xiàn)在可以發(fā)送聊天嘗試。我這里報錯,是因為我要使用 0011.ai 代理。沒有配。后面在 openclaw.json 中配置

三、openclaw 目錄結構
目錄在 ~/.openclaw
.
├── agents
│ └── main
│ ├── agent
│ │ └── models.json
│ └── sessions
│ ├── faf8ec2c-238b-4aa8-88ef-7233dcbcd4e0.jsonl
│ └── sessions.json
├── canvas
│ └── index.html
├── cron
│ └── jobs.json
├── devices
│ ├── paired.json
│ └── pending.json
├── identity
│ ├── device-auth.json
│ └── device.json
├── logs
│ ├── config-audit.jsonl
│ ├── gateway.err.log
│ └── gateway.log
├── memory
│ └── main.sqlite
├── openclaw.json
├── update-check.json
└── workspace
├── AGENTS.md
├── BOOTSTRAP.md
├── HEARTBEAT.md
├── IDENTITY.md
├── SOUL.md
├── TOOLS.md
└── USER.md| 路徑 | 類型 | 作用 |
|---|---|---|
| openclaw.json | 主配置 | OpenClaw 主配置文件,包含 gateway 端口、token、provider API、models、agents 配置 |
| update-check.json | 更新記錄 | 記錄 OpenClaw 是否檢查過新版本 |
| memory/main.sqlite | 數(shù)據(jù)庫 | Agent 長期記憶數(shù)據(jù)庫(對話、上下文、狀態(tài)) |
| logs/gateway.log | 日志 | Gateway 正常運行日志 |
| logs/gateway.err.log | 日志 | Gateway 錯誤日志 |
| logs/config-audit.jsonl | 日志 | 記錄配置文件修改歷史 |
| workspace/ | 工作區(qū) | Agent 執(zhí)行任務、生成代碼、存放文件的目錄 |
| workspace/AGENTS.md | Prompt | 定義 Agent 類型和行為 |
| workspace/BOOTSTRAP.md | Prompt | Agent 啟動時的 system prompt |
| workspace/HEARTBEAT.md | Prompt | Agent 心跳 / 狀態(tài)更新規(guī)則 |
| workspace/IDENTITY.md | Prompt | Agent 身份定義 |
| workspace/SOUL.md | Prompt | Agent 行為哲學 / 規(guī)則 |
| workspace/TOOLS.md | Prompt | Agent 可用工具說明 |
| workspace/USER.md | Prompt | 用戶信息與偏好 |
| identity/ | 認證 | 身份認證 |
| identity/device-auth.json | 認證 | 設備 / 客戶端認證信息 |
| identity/device.json | 設備信息 | 記錄當前設備標識 |
| cron/ | 調度系統(tǒng) | OpenClaw 內置 cron scheduler 的配置目錄 |
| cron/jobs.json | 定時任務配置 | 存儲 OpenClaw 的 定時任務(cron jobs) |
| devices/ | 設備管理 | OpenClaw 的 設備配對系統(tǒng) |
| devices/paired.json | 設備列表 | 已經(jīng)授權的設備(Dashboard / CLI / Remote) |
| devices/pending.json | 配對隊列 | 等待授權的設備 |
四、配置 openclaw。
1.openclaw.json配置文件
{
"wizard": {
// 上次運行初始化向導的時間
"lastRunAt": "2026-03-09T01:29:44.906Z",
// 上次運行向導時的 OpenClaw 版本
"lastRunVersion": "2026.3.2",
// 最后執(zhí)行的初始化命令(通常是 onboard)
"lastRunCommand": "onboard",
// 運行模式:local / cloud
"lastRunMode": "local"
},
"agents": {
"defaults": {
// Agent 的工作目錄
// AI 生成文件、執(zhí)行任務都會在這里
"workspace": "/Users/xxx/.openclaw/workspace",
"compaction": {
// 上下文壓縮策略
// safeguard = 防止上下文爆炸
"mode": "safeguard"
},
// 同時運行的最大 agent 數(shù)
"maxConcurrent": 4,
"subagents": {
// 子 agent 最大并發(fā)數(shù)量
"maxConcurrent": 8
}
}
},
"tools": {
// 工具權限配置。這里控制模型是否有權限訪問本機電腦。full 為所有權限
// messaging / standard / full
"profile": "messaging"
},
"messages": {
// 消息確認范圍
// group-mentions = 只響應提及
"ackReactionScope": "group-mentions"
},
"commands": {
// 是否使用本地原生命令
"native": "auto",
// 是否自動加載 native skills
"nativeSkills": "auto",
// 命令執(zhí)行失敗是否自動重啟
"restart": true,
// 命令執(zhí)行者顯示方式
// raw = 顯示真實用戶名
"ownerDisplay": "raw"
},
"session": {
// DM 會話范圍
// per-channel-peer = 每個頻道獨立會話
"dmScope": "per-channel-peer"
},
"hooks": {
"internal": {
// 是否啟用內部 hook 系統(tǒng)
"enabled": true,
"entries": {
"boot-md": {
// 啟動時加載 workspace 中的 BOOTSTRAP.md
"enabled": true
},
"command-logger": {
// 記錄命令執(zhí)行日志
"enabled": true
},
"session-memory": {
// 啟用會話記憶系統(tǒng)
"enabled": true
}
}
}
},
"gateway": {
// OpenClaw Web Dashboard 端口
"port": 18789,
// gateway 運行模式
// local = 僅本地訪問
"mode": "local",
// 監(jiān)聽地址
// loopback = 127.0.0.1
"bind": "loopback",
"auth": {
// 認證方式
// token / none
"mode": "token",
// Dashboard 登錄 token
"token": "372ec8cbcfe557ee947ec76bccd63f33022bb673c282de48"
},
"tailscale": {
// 是否啟用 Tailscale 遠程訪問
"mode": "off",
// 程序退出時是否重置網(wǎng)絡
"resetOnExit": false
},
"nodes": {
// 禁止 AI 執(zhí)行的系統(tǒng)命令
"denyCommands": [
"camera.snap",
"camera.clip",
"screen.record",
"contacts.add",
"calendar.add",
"reminders.add",
"sms.send"
]
}
},
"models": {
// provider 合并模式
// merge = 合并多個 provider
"mode": "merge",
"providers": {
"anthropic": {
// API 代理地址
"baseUrl": "https://aicoding.2233.ai",
// API Key
"apiKey": "sk-c4pBAcG",
// API 類型
// anthropic-messages = Claude Messages API
"api": "anthropic-messages",
"models": [
{
// 模型 ID
"id": "claude-opus-4",
// 模型顯示名稱
"name": "claude-opus-4"
}
]
}
}
},
"auth": {
"profiles": {
"anthropic:default": {
// 使用哪個 provider
"provider": "anthropic",
// 認證模式
// api_key / oauth
"mode": "api_key"
}
}
},
channels: {
// 根據(jù)聊天平臺 + 頻道 ID 自動選擇模型
modelByChannel: {
discord: {
// Discord 頻道 ID
// 如果用戶在這個頻道聊天
// OpenClaw 會使用 Claude Opus
"123456789012345678": "anthropic/claude-opus-4-6",
},
slack: {
// Slack channel ID
// 在這個頻道里聊天會使用 GPT-4.1
C1234567890: "openai/gpt-4.1",
},
telegram: {
// Telegram 群 ID
// 所有消息默認使用 GPT-4.1 mini
"-1001234567890": "openai/gpt-4.1-mini",
// Telegram topic (論壇模式)
// 格式:
// group_id:topic:topic_id
//
// 在 topic 99 里使用 Claude Sonnet
"-1001234567890:topic:99": "anthropic/claude-sonnet-4-6",
},
},
},
"meta": {
// 最后修改配置的 OpenClaw 版本
"lastTouchedVersion": "2026.3.2",
// 最后修改時間
"lastTouchedAt": "2026-03-09T01:29:44.914Z"
}
}2. 常用配置
| 配置 | 作用 |
|---|---|
| gateway.port | Dashboard 端口 |
| gateway.auth.token | 登錄 token |
| models.providers | AI 模型提供商 |
| agents.defaults.workspace | Agent 工作目錄 |
| tools.profile | 模型權限,full 系統(tǒng)所有權限 |
五、安裝 skill
ClawHub 是 OpenClaw 生態(tài)里的 插件 / 模塊倉庫管理工具。
1. 安裝clawhub
npm install -g clawhub
2. 常用參數(shù)和用法
| 命令 | 作用 | 示例 |
|---|---|---|
| clawhub search | 搜索模塊 | clawhub search discord |
| clawhub install | 安裝模塊 | clawhub install discord |
| clawhub remove | 刪除模塊 | clawhub remove discord |
| clawhub list | 查看已安裝模塊 | clawhub list |
| clawhub info | 查看模塊信息 | clawhub info discord |
| clawhub update | 更新模塊 | clawhub update discord |
| clawhub upgrade | 更新所有模塊 | clawhub upgrade |
| clawhub enable | 啟用模塊 | clawhub enable discord |
| clawhub disable | 禁用模塊 | clawhub disable discord |
| clawhub doctor | 檢查模塊問題 | clawhub doctor |
| clawhub repo add | 添加倉庫 | clawhub repo add <url> |
| clawhub repo list | 查看倉庫 | clawhub repo list |
| clawhub repo remove | 刪除倉庫 | clawhub repo remove <url> |
六、openclaw常用命令
1. 基礎命令
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw | 顯示幫助 | openclaw |
| openclaw version | 查看版本 | openclaw version |
| openclaw help | 查看幫助 | openclaw help |
| openclaw status | 查看運行狀態(tài) | openclaw status |
2. 初始化
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw onboard --install-daemon | 完整安裝向導和安裝系統(tǒng)服務 | openclaw onboard --install-daemon |
| openclaw onboard | 安裝向導 | openclaw onboard |
| openclaw start | 啟動 gateway + agent | openclaw start |
| openclaw stop | 停止 OpenClaw | openclaw stop |
| openclaw restart | 重啟服務 | openclaw restart |
3. 日志
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw logs | 查看日志 | openclaw logs |
| openclaw logs --follow | 實時日志 | openclaw logs --follow |
| openclaw logs --errors | 只看錯誤日志 | openclaw logs --errors |
4. 模型管理
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw models list | 查看可用模型 | openclaw models list |
| openclaw models auth login | 登錄模型 provider | openclaw models auth login |
| openclaw models auth logout | 退出登錄 | openclaw models auth logout |
| openclaw models test | 測試模型連接 | openclaw models test |
5. 系統(tǒng)插件
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw plugins list | 查看插件 | openclaw plugins list |
| openclaw plugins install | 安裝插件 | openclaw plugins install discord |
| openclaw plugins remove | 刪除插件 | openclaw plugins remove discord |
| openclaw plugins update | 更新插件 | openclaw plugins update |
6. Agent 管理
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw agents list | 查看 agent | openclaw agents list |
| openclaw agents add | 添加 agent | openclaw agents add coder |
| openclaw agents remove | 刪除 agent | openclaw agents remove coder |
| openclaw agents restart | 重啟 agent | openclaw agents restart |
7. 設備管理
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw devices list | 查看已配對設備 | openclaw devices list |
| openclaw devices approve | 批準設備 | openclaw devices approve |
| openclaw devices remove | 移除設備 | openclaw devices remove |
8. 配置管理
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw config show | 查看配置 | openclaw config show |
| openclaw config edit | 編輯配置 | openclaw config edit |
| openclaw config reset | 重置配置 | openclaw config reset |
9. 調試 / 診斷
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw doctor | 檢查系統(tǒng)問題 | openclaw doctor |
| openclaw debug | 調試模式 | openclaw debug |
| openclaw env | 查看環(huán)境信息 | openclaw env |
10. 開發(fā)工具
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw run | 運行 agent 任務 | openclaw run |
| openclaw exec | 執(zhí)行命令 | openclaw exec |
| openclaw shell | 打開 agent shell | openclaw shell |
11. 更新
| 命令 | 作用 | 示例 |
|---|---|---|
| openclaw update | 更新 OpenClaw | openclaw update |
| openclaw upgrade | 升級組件 | openclaw upgrade |
到此這篇關于macos部署openclaw的圖文步驟的文章就介紹到這了,更多相關macos部署openclaw內容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持腳本之家!
相關文章

各平臺 完整卸載OpenClaw的完全指南(Windows/macOS/Linux/npm/pnpm)
這篇文章主要為大家介紹了 OpenClaw 在 Windows、macOS、Linux 系統(tǒng)及 npm、pnpm 包管理器下的全平臺 完整卸載教程,文中的示例代碼講解詳細,感興趣的小伙伴可以了解下2026-03-12
Windows/macOS/Linux系統(tǒng)卸載OpenClaw教程(附一鍵腳本+檢測工具)
使用OpenClaw后想卸載,卻擔心刪不干凈,殘留文件占用空間,后臺服務偷偷運行,今天就給大家分享一套完整的OpenClaw徹底卸載方案,從一鍵卸載到殘留檢測,全程無需復雜操作2026-03-12
本文主要介紹了在macOS上徹底卸載OpenClaw的詳細步驟,包括應用內的卸載、Homebrew卸載、深度清理殘留文件、卸載OpenClaw CLI和移除macOS后臺服務,具有一定的參考價值,感興2026-03-11
Windows、macOS、Linux三系統(tǒng)本地部署OpenClaw+避坑指南+Docker一鍵部署,30分鐘搞定
本文給大家分享全網(wǎng)最全的OpenClaw安裝部署教程,覆蓋Windows、macOS、Linux三系統(tǒng)本地部署,并最終提供Docker一鍵部署方案,感興趣的朋友一起看看吧2026-03-10
Mac mini上部署配置OpenClaw并接入國產(chǎn)大模型與飛書
本文詳細介紹了在Macmini上部署OpenClaw的全過程,包括配置安裝及國產(chǎn)大模型接入以及飛書機器人集成,搭建一個的AI助手,滿足日常自動化需求,需要的朋友們下面隨著小編來一起2026-03-09
本文面向非程序員用戶,詳細記錄了在一臺全新 Mac 電腦上從零開始安裝 OpenClaw 并配置飛書機器人的完整流程2026-03-07
本文詳細介紹如何在 macOS 本地部署 OpenClaw 智能助理框架,從環(huán)境準備到首次運行,手把手教你搭建屬于自己的 AI 助理,適合零基礎新手,全程實操無坑,需要的朋友可以參考2026-03-06
OpenClaw 完全可以在筆記本上用,但很多人會推薦 Mac mini,是因為「長期當服務器」這件事對硬件有不同要求,低功耗、配置容易上手、錯誤少,所以選擇mini是更好的選擇2026-03-02
本文將詳細介紹如何在 M1 Mac 安裝和配置OpenClaw 的完整過程,通過示例代碼介紹的非常詳細,包括遇到的坑和解決方案,需要的朋友們下面隨著小編來一起學習學習吧2026-03-02
蘋果Macmini下OpenClaw保姆級配置教程(全網(wǎng)最簡單)
如果你也想把 Macmini 變成 24h 在線的 私人秘書,這篇就是保姆級喂飯教程,為什么選擇mac mini來配置OpenClaw,因為OpenClaw是在unix開發(fā)的,而openclaw也是unix系統(tǒng),所2026-03-09











