Toggle
- 问题背景
- 解决步骤1. 停止当前Gateway服务
- 2.编辑openclaw文件并添加代理环境变量
- 3.重新启动Gateway
- 4. 验证状态
注意事项
问题背景
在macOS上运行OpenClaw Gateway时,访问外部Ai异常外部网无法接收到消息的问题,原因是**Gateway进程没有正确使用本地代理环境变量**。
原因在于:**OpenClaw默认启动的服务不会继承终端中的export变量**,除非开启tun模式
---
解决步骤
1. 停止当前Gateway服务
openclaw gateway stop2.编辑openclaw文件并添加代理环境变量
路径:
vim ~/Library/LaunchAgents/ai.openclaw.gateway.plist完整配置示例: 端口请根据实际情况填写
➜ ~ tail -n 15 ~/Library/LaunchAgents/ai.openclaw.gateway.plist
<string>openclaw</string>
<key>OPENCLAW_SERVICE_KIND</key>
<string>gateway</string>
<key>OPENCLAW_SERVICE_VERSION</key>
<string>2026.3.2</string>
<!-- 代理设置 -->
<key>HTTP_PROXY</key>
<string>http://127.0.0.1:10808</string>
<key>HTTPS_PROXY</key>
<string>http://127.0.0.1:10808</string>
<key>ALL_PROXY</key>
<string>socks5://127.0.0.1:10808</string>
</dict>
</dict>
</plist>3.重新启动Gateway
➜ ~ openclaw gateway restart4. 验证状态
openclaw gateway status
openclaw logs --follow注意事项
1. 如果仍然超时:需要排查 软件问题确认软件是否正常