Files

105 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

---
2026-01-30 03:15:10 +01:00
summary: "Setup guide for developers working on the OpenClaw macOS app"
read_when:
- Setting up the macOS development environment
title: "macOS Dev Setup"
---
2026-01-31 21:13:13 +09:00
# macOS Developer Setup
2026-01-30 03:15:10 +01:00
This guide covers the necessary steps to build and run the OpenClaw macOS application from source.
## Prerequisites
Before building the app, ensure you have the following installed:
1. **Xcode 26.2+**: Required for Swift development.
2. **Node.js 22+ & pnpm**: Required for the gateway, CLI, and packaging scripts.
2026-01-18 07:47:01 +00:00
## 1. Install Dependencies
Install the project-wide dependencies:
```bash
pnpm install
```
2026-01-18 07:47:01 +00:00
## 2. Build and Package the App
2026-01-30 03:15:10 +01:00
To build the macOS app and package it into `dist/OpenClaw.app`, run:
```bash
./scripts/package-mac-app.sh
```
2026-01-31 21:13:13 +09:00
If you don't have an Apple Developer ID certificate, the script will automatically use **ad-hoc signing** (`-`).
2026-01-18 16:24:38 +00:00
For dev run modes, signing flags, and Team ID troubleshooting, see the macOS app README:
[https://github.com/openclaw/openclaw/blob/main/apps/macos/README.md](https://github.com/openclaw/openclaw/blob/main/apps/macos/README.md)
2026-01-18 16:24:38 +00:00
> **Note**: Ad-hoc signed apps may trigger security prompts. If the app crashes immediately with "Abort trap 6", see the [Troubleshooting](#troubleshooting) section.
2026-01-18 07:47:01 +00:00
## 3. Install the CLI
2026-01-30 03:15:10 +01:00
The macOS app expects a global `openclaw` CLI install to manage background tasks.
2026-01-11 10:15:37 +00:00
**To install it (recommended):**
2026-01-31 21:13:13 +09:00
1. Open the OpenClaw app.
2. Go to the **General** settings tab.
3. Click **"Install CLI"**.
2026-01-11 10:15:37 +00:00
Alternatively, install it manually:
2026-01-31 21:13:13 +09:00
```bash
2026-01-30 03:15:10 +01:00
npm install -g openclaw@<version>
```
## Troubleshooting
### Build Fails: Toolchain or SDK Mismatch
2026-01-31 21:13:13 +09:00
The macOS app build expects the latest macOS SDK and Swift 6.2 toolchain.
**System dependencies (required):**
2026-01-31 21:13:13 +09:00
- **Latest macOS version available in Software Update** (required by Xcode 26.2 SDKs)
- **Xcode 26.2** (Swift 6.2 toolchain)
**Checks:**
2026-01-31 21:13:13 +09:00
```bash
xcodebuild -version
xcrun swift --version
```
If versions dont match, update macOS/Xcode and re-run the build.
### App Crashes on Permission Grant
2026-01-31 21:13:13 +09:00
If the app crashes when you try to allow **Speech Recognition** or **Microphone** access, it may be due to a corrupted TCC cache or signature mismatch.
**Fix:**
2026-01-31 21:13:13 +09:00
1. Reset the TCC permissions:
```bash
tccutil reset All bot.molt.mac.debug
```
2026-01-30 03:15:10 +01:00
2. If that fails, change the `BUNDLE_ID` temporarily in [`scripts/package-mac-app.sh`](https://github.com/openclaw/openclaw/blob/main/scripts/package-mac-app.sh) to force a "clean slate" from macOS.
### Gateway "Starting..." indefinitely
2026-01-31 21:13:13 +09:00
If the gateway status stays on "Starting...", check if a zombie process is holding the port:
```bash
2026-01-30 03:15:10 +01:00
openclaw gateway status
openclaw gateway stop
# If youre not using a LaunchAgent (dev mode / manual runs), find the listener:
lsof -nP -iTCP:18789 -sTCP:LISTEN
```
2026-01-31 21:13:13 +09:00
If a manual run is holding the port, stop that process (Ctrl+C). As a last resort, kill the PID you found above.