Mac M 芯片 OpenClaw 环境搭建与运行指南
一、前置检查(必做)
确认你的 Mac 是 M 系列芯片:
uname -m # 输出 arm64 说明是 M 芯片
二、安装依赖(M 芯片适配)
1. 安装 / 配置 Homebrew
如果已装 Homebrew,跳过此步;未安装则执行:
# 安装 Homebrew(M 芯片默认路径:/opt/homebrew)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 配置 Homebrew 环境变量(M 芯片必须,否则 brew 命令找不到)
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
source ~/.zshrc
# 验证 Homebrew 路径
brew --prefix # 输出 /opt/homebrew 即为正确
若安装过程中出现超时或连接 GitHub 失败(如 443 端口超时),需配置镜像源。终端执行如下命令:
export HOMEBREW_BREW_GIT_REMOTE="https://mirrors.ustc.edu.cn/brew.git"
export HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
针对不同 Shell 的配置方式
Bash 终端:
如果 echo $SHELL 输出 /bin/bash,请修改 ~/.bash_profile:
# 删除可能存在的错误 zshrc 配置
if [ -f ~/.zshrc ]; then
sed -i '' '/HOMEBREW_BOTTLE_DOMAIN/d' ~/.zshrc
sed -i '' '/HOMEBREW_API_DOMAIN/d' ~/.zshrc
fi
# 配置 brew 镜像到 bash 配置文件
echo 'export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"' >> ~/.bash_profile
>> ~/.bash_profile
~/.bash_profile



