OpenClaw Gateway crashes or hangs with these errors:
spawn EBADF when running exec commandsRPC probe failed / gateway timeoutEMFILE: too many open files, watchThe Gateway automatically watches all files under ~/.openclaw/workspace/ for changes. If you place virtual environments (.venv), node_modules, large datasets, or tens of thousands of small files inside workspace, the file watcher will exceed macOS's default file descriptor limit (256), causing the process to hang.
Run the one-click repair script:
bash fix.sh
What it does:
.venv, node_modules) inside workspaceIf you prefer to fix manually:
```bash
# Never put these inside ~/.openclaw/workspace/:
rm -rf ~/.openclaw/workspace/*/.venv
rm -rf ~/.openclaw/workspace/*/node_modules
# Move datasets/models/venvs to ~/Downloads/ or /tmp/
```
Edit ~/Library/LaunchAgents/ai.openclaw.gateway.plist and add inside the root :
```xml
```
```bash
launchctl bootout gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.plist
sleep 10 && openclaw gateway status
```
✅ Do NOT put these inside ~/.openclaw/workspace/:
.venv, venv)node_modules directories✅ Put these outside workspace: /tmp/, ~/Downloads/, or any directory outside ~/.openclaw/workspace/
After fix, run:
openclaw gateway status
You should see RPC probe: ok in the output.
If fix fails:
tail -50 ~/.openclaw/logs/gateway.err.logfind ~/.openclaw/workspace -type f | wc -l (should be < 1000)openclaw gateway stop && openclaw gateway install共 1 个版本