Gateway 在 macOS 上(外部 launchd)

Gateway 在 macOS 上(外部 launchd)

适用范围

在以下情况使用此页面:

  • 打包 Clawdbot.app
  • 调试 macOS 网关 launchd 服务
  • 安装 macOS 的网关 CLI

Clawdbot.app 不再捆绑 Node/Bun 或网关运行时。macOS 应用期望外部 clawdbot CLI 安装,不将网关生成为子进程,并管理每用户 launchd 服务以保持网关运行(或附加到已运行的现有本地网关)。

安装 CLI(本地模式需要)

你需要在 Mac 上安装 Node 22+,然后全局安装 clawdbot

npm install -g clawdbot@<version>

macOS 应用的安装 CLI按钮通过 npm/pnpm 运行相同的流程(不推荐将 bun 用于网关运行时)。

Launchd(网关作为 LaunchAgent)

标签:

  • com.clawdbot.gateway(或 com.clawdbot.<profile>

Plist 位置(每用户):

  • ~/Library/LaunchAgents/com.clawdbot.gateway.plist (或 ~/Library/LaunchAgents/com.clawdbot.<profile>.plist

管理器:

  • macOS 应用拥有本地模式下的 LaunchAgent 安装/更新。
  • CLI 也可以安装它:clawdbot gateway install

行为:

  • “Clawdbot 活动"启用/禁用 LaunchAgent。
  • 应用退出停止网关(launchd 保持其活动)。
  • 如果网关已在配置的端口上运行,应用将附加到它而不是启动新的。

日志记录:

  • launchd stdout/err:/tmp/clawdbot/clawdbot-gateway.log

版本兼容性

macOS 应用检查网关版本与其自身版本的兼容性。如果不兼容,请更新全局 CLI 以匹配应用版本。

烟雾检查

clawdbot --version

CLAWDBOT_SKIP_CHANNELS=1 \
CLAWDBOT_SKIP_CANVAS_HOST=1 \
clawdbot gateway --port 18999 --bind loopback

然后:

clawdbot gateway call health --url ws://127.0.0.1:18999 --timeout 3000