O
OpenClaw
首页博客关于文档社区
O
OpenClaw

OpenClaw - 你的AI助手平台。连接AI能力,让工作更高效,生活更有趣。

导航

  • 首页
  • 博客
  • 关于
  • 文档
  • 社区

资源

  • GitHub
  • Discord
  • 使用文档
© 2026 OpenClaw. All rights reserved.Powered by OpenClaw & Next.js
返回首页
技术

macOS 安装 OpenClaw 指南

技
技术老炮
2026年3月19日
|
1 阅读
|
2 分钟阅读
分享:

# macOS 安装 OpenClaw 指南


在 Mac 上安装 OpenClaw AI 助手平台


环境要求


  • macOS 12 (Monterey) 或更高版本
  • 4GB+ RAM
  • Homebrew 已安装

第一步:安装 Homebrew


bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

第二步:安装依赖


bash
# 安装 Node.js 20
brew install node@20

# 安装 PostgreSQL
brew install postgresql@14
brew services start postgresql

# 创建数据库
createuser -s openclaw
createdb openclaw
psql -c "ALTER USER openclaw WITH PASSWORD 'password123';" postgres

第三步:安装 OpenClaw


bash
# 克隆项目
cd ~/Developer
git clone https://github.com/openclaw/openclaw.git
cd openclaw

# 安装依赖
npm install

# 配置环境变量
cp .env.example .env
nano .env

配置内容:

env
DATABASE_URL=postgresql://openclaw:password123@localhost:5432/openclaw
JWT_SECRET=your-secret-key
AI_PROVIDER=openai
OPENAI_API_KEY=sk-your-key

第四步:初始化并启动


bash
# 生成 Prisma 客户端
npx prisma generate

# 同步数据库
npx prisma db push

# 启动开发服务器
npm run dev

第五步:访问


浏览器打开 http://localhost:3000


使用 LaunchAgent 开机自启 (可选)


创建 ~/Library/LaunchAgents/com.openclaw.plist:


xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.openclaw</string>
    <key>ProgramArguments</key>
    <array>
        <string>/opt/homebrew/bin/node</string>
        <string>/Users/yourusername/Developer/openclaw/index.js</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/Users/yourusername/Developer/openclaw</string>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

加载:

bash
launchctl load ~/Library/LaunchAgents/com.openclaw.plist

常见问题


PostgreSQL 无法启动


bash
brew services restart postgresql@14

端口被占用


bash
lsof -i :3000
# 或修改 .env 中的 PORT

---


相关教程:

  • [Ubuntu 安装](/post/install-openclaw-ubuntu)
  • [Docker 安装](/post/install-openclaw-docker)

标签

#OpenClaw#macOS#Homebrew#安装教程

相关文章

Ubuntu/Debian 系统安装 OpenClaw 完整指南

详细步骤指南:在 Ubuntu 和 Debian 系统上安装 OpenClaw AI 助手平台,包含开发环境和生产环境配置。

2026-03-20

CentOS/RHEL 系统安装 OpenClaw 指南

# CentOS/RHEL 系统安装 OpenClaw 指南 > 本教程详细介绍如何在 CentOS Stream 9 或 RHEL 9 上安装 OpenClaw ## 环境要求 - CentO

2026-03-20

Windows WSL2 安装 OpenClaw 教程

在 Windows 11/10 上通过 WSL2 Ubuntu 安装 OpenClaw 的详细教程,适合开发环境。

2026-03-20
上一篇

Windows WSL2 安装 OpenClaw 教程

下一篇

Docker 安装 OpenClaw 最简指南

订阅博客更新

通过 RSS 订阅,及时获取最新文章

RSS 订阅链接
返回文章列表

评论 (0)

发表评论

0/1000