Clawdbot macOS App Build
The macOS companion app provides menu-bar status, native notifications, and access to Mac hardware (camera, screen recording, system commands). This skill builds it from source.
Prerequisites
- - macOS (10.14+)
- Xcode 15+ with Command Line Tools
- Node.js >= 22
- pnpm package manager
- 30+ GB free disk space (Swift build artifacts)
- Internet connection (large dependencies)
Quick Build
CODEBLOCK0
Build Steps Explained
1. Clone Repository
Clones the latest Clawdbot source from GitHub. This includes the macOS app source in
apps/macos/.
2. Install Dependencies (pnpm install)
Installs Node.js dependencies for the entire workspace (~1 minute). Warnings about missing binaries in some extensions are harmless.
3. Build UI (pnpm ui:build)
Compiles the Control UI (Vite → TypeScript/React). Output goes to
dist/control-ui/. Takes ~30 seconds.
4. Accept Xcode License
Required once per Xcode update. If you get "license not agreed" errors during Swift build, run:
CODEBLOCK1
5. Package macOS App (scripts/package-mac-app.sh)
Runs the full Swift build pipeline:
- - Fetches Swift package dependencies (SwiftUI libraries, etc.)
- Compiles the macOS app for your architecture (arm64 for M1+, x86_64 for Intel)
- Bundles resources (model catalog, localizations, etc.)
- Code-signs the app
Signing options:
- - Ad-hoc signing (fastest):
ALLOW_ADHOC_SIGNING=1 — good for local testing, app won't notarize for distribution - Developer ID signing (production): Set
SIGN_IDENTITY="Developer ID Application: <name>" if you have a signing certificate
This step takes 10-20 minutes depending on your Mac.
6. Install to /Applications
Copies the built app to the system Applications folder so it runs like any other macOS app.
7. Launch
Opens the app. On first run, you'll see permission prompts (Notifications, Accessibility, Screen Recording, etc.) — approve them for full functionality.
Troubleshooting
"Invalid tools version"
Swift build requires 6.2+. Update Xcode:
CODEBLOCK2
"License not agreed"
CODEBLOCK3
"No signing identity found"
Use ad-hoc signing for local builds:
CODEBLOCK4
Swift compilation hangs or is very slow
- - Ensure Xcode is fully updated:
xcode-select --install or update via App Store - Check disk space:
df -h (need ~30GB free) - Close other apps to free RAM
App won't launch after build
Check that it's properly signed:
CODEBLOCK5
If signing failed, rebuild with ALLOW_ADHOC_SIGNING=1.
What the App Does
- - Menu bar status — See Gateway health and receive notifications
- Permission management — Owns TTC prompts for Notifications, Accessibility, Screen Recording, Microphone, etc.
- Local/Remote modes:
-
Local: Gateway runs on your Mac; app manages launchd service
-
Remote: App connects to Gateway on another machine (VPS, home server) via SSH/Tailscale; keeps your Mac accessible even while sleeping
- - Mac hardware access: Camera, screen recording, Canvas, voice wake-word
- Deep linking: Trigger agent requests via
clawdbot:// URL scheme
See the official docs: https://docs.clawd.bot/platforms/macos
Building for Distribution
For production distribution, you'll need:
- - Apple Developer ID certificate (paid)
- Notarization credentials
- See: https://docs.clawd.bot/platforms/mac/release
For personal use, ad-hoc signing is fine.
Next Steps
After the app launches:
- 1. Complete the permission checklist (TCC prompts)
- Choose Local or Remote mode
- If Local: ensure the Gateway is running (
clawdbot gateway status) - Open Clawdbot.app menu bar icon to configure
Then from the terminal, you can manage the Gateway:
CODEBLOCK6
Clawdbot macOS 应用构建
macOS 配套应用提供菜单栏状态、原生通知以及访问 Mac 硬件(摄像头、屏幕录制、系统命令)的功能。本技能将从头构建该应用。
前置条件
- - macOS(10.14 及以上版本)
- Xcode 15+(含命令行工具)
- Node.js >= 22
- pnpm 包管理器
- 30+ GB 可用磁盘空间(Swift 构建产物)
- 互联网连接(大型依赖包)
快速构建
bash
克隆仓库
cd /tmp && rm -rf clawdbot-build && git clone https://github.com/clawdbot/clawdbot.git clawdbot-build
安装并构建
cd /tmp/clawdbot-build
pnpm install
pnpm ui:build
接受 Xcode 许可(一次性操作)
sudo xcodebuild -license accept
使用临时签名构建 macOS 应用
ALLOW
ADHOCSIGNING=1 bash scripts/package-mac-app.sh
安装到 /Applications 目录
cp -r dist/Clawdbot.app /Applications/Clawdbot.app
启动应用
open /Applications/Clawdbot.app
构建步骤详解
1. 克隆仓库
从 GitHub 克隆最新的 Clawdbot 源代码。macOS 应用源码位于 apps/macos/ 目录下。
2. 安装依赖(pnpm install)
安装整个工作区的 Node.js 依赖(约需 1 分钟)。某些扩展中缺失二进制文件的警告可以忽略。
3. 构建 UI(pnpm ui:build)
编译控制界面(Vite → TypeScript/React)。输出文件位于 dist/control-ui/ 目录。约需 30 秒。
4. 接受 Xcode 许可
每次 Xcode 更新后需要执行一次。如果在 Swift 构建过程中遇到许可未同意错误,请运行:
bash
sudo xcodebuild -license accept
5. 打包 macOS 应用(scripts/package-mac-app.sh)
运行完整的 Swift 构建流程:
- - 获取 Swift 包依赖(SwiftUI 库等)
- 为当前架构编译 macOS 应用(M1+ 为 arm64,Intel 为 x86_64)
- 打包资源(模型目录、本地化文件等)
- 对应用进行代码签名
签名选项:
- - 临时签名(最快):ALLOWADHOCSIGNING=1 — 适合本地测试,应用无法公证以用于分发
- 开发者 ID 签名(生产环境):如果您有签名证书,请设置 SIGN_IDENTITY=Developer ID Application: <名称>
此步骤根据 Mac 性能不同,需要 10-20 分钟。
6. 安装到 /Applications 目录
将构建好的应用复制到系统应用程序文件夹,使其像其他 macOS 应用一样运行。
7. 启动应用
打开应用。首次运行时,您会看到权限提示(通知、辅助功能、屏幕录制等)——请批准这些权限以获得完整功能。
故障排除
无效的工具版本
Swift 构建需要 6.2+ 版本。请更新 Xcode:
bash
softwareupdate -i -a
许可未同意
bash
sudo xcodebuild -license accept
未找到签名身份
本地构建请使用临时签名:
bash
ALLOW
ADHOCSIGNING=1 bash scripts/package-mac-app.sh
Swift 编译卡住或非常慢
- - 确保 Xcode 已完全更新:xcode-select --install 或通过 App Store 更新
- 检查磁盘空间:df -h(需要约 30GB 可用空间)
- 关闭其他应用以释放内存
构建后应用无法启动
检查应用是否正确签名:
bash
codesign -v /Applications/Clawdbot.app
如果签名失败,请使用 ALLOWADHOCSIGNING=1 重新构建。
应用功能
- - 菜单栏状态 — 查看网关健康状态并接收通知
- 权限管理 — 管理通知、辅助功能、屏幕录制、麦克风等 TCC 提示
- 本地/远程模式:
-
本地模式: 网关在 Mac 上运行;应用管理 launchd 服务
-
远程模式: 应用通过 SSH/Tailscale 连接到另一台机器(VPS、家庭服务器)上的网关;即使 Mac 处于休眠状态也能保持可访问
- - Mac 硬件访问: 摄像头、屏幕录制、Canvas、语音唤醒词
- 深度链接: 通过 clawdbot:// URL 方案触发代理请求
请参阅官方文档:https://docs.clawd.bot/platforms/macos
构建用于分发
对于生产环境分发,您需要:
- - Apple 开发者 ID 证书(付费)
- 公证凭证
- 请参阅:https://docs.clawd.bot/platforms/mac/release
个人使用的话,临时签名就足够了。
后续步骤
应用启动后:
- 1. 完成权限检查清单(TCC 提示)
- 选择本地或远程模式
- 如果选择本地模式:确保网关正在运行(clawdbot gateway status)
- 打开 Clawdbot.app 菜单栏图标进行配置
然后,您可以在终端中管理网关:
bash
clawdbot gateway status
clawdbot gateway restart