openclaw - 💡(How to fix) Fix [Bug]: [macOS ARM64] Gateway crashes on Apple Silicon (M1/M2/M3) - Code Signing + Resource Exhaustion [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#59052Fetched 2026-04-08 02:29:21
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Error Message

console.warn(⚠ Download incomplete (${stats.size} < ${expectedSize}), retrying... (${i + 1}/${retries})); throw new Error(Failed to download complete binary after ${retries} attempts); exec(codesign -verify "${binaryPath}", (error) => { if (error) { console.error('❌ Code signing verification failed'); console.error('Please re-download the binary or contact support'); reject(error); console.warn(⚠ High memory usage: ${memMB} MB); console.error('❌ Crypto module appears incomplete (< 10MB)'); console.error('Run: node download-lib.js in the module directory');

Root Cause

The OpenClaw gateway crashes within seconds of startup on macOS ARM64 (Apple Silicon M1/M2/M3) Macs. The crashes are caused by a combination of:

Fix Action

Fix / Workaround

Workaround / Patch

A community patch has been developed that resolves these issues:

Patch Script

#!/bin/bash
# OpenClaw MacBook ARM64 Gateway Patch
# https://github.com/openclaw/openclaw/issues/[ISSUE_NUMBER]

Code Example

{
  "signal": "SIGKILL (Code Signature Invalid)",
  "termination": {
    "namespace": "CODESIGNING",
    "indicator": "Invalid Page"
  },
  "ktriageinfo": "VM - A memory corruption was found in executable text"
}

---

Expected size: ~22 MB
Actual size: ~11 MB (50% incomplete)

---

CPU: 95% average (limit: 50%)
Memory: 366MB → 1.5GB+ (memory leak)
Duration: 90 seconds before termination

---

launchd misidentifies frequent restarts as crash loop
After 4 quick exits within 5-10 minutes, service is automatically unloaded

---

npm install -g openclaw@latest

---

{
     "channels": {
       "matrix": {
         "encryption": true
       }
     }
   }

---

openclaw gateway

---



---

#!/bin/bash
# OpenClaw MacBook ARM64 Gateway Patch
# https://github.com/openclaw/openclaw/issues/[ISSUE_NUMBER]

set -e

# 1. Stop existing gateway
pkill -9 -f 'openclaw-gateway' || true

# 2. Re-download crypto module (fixes truncated binary)
cd ~/.nvm/versions/node/*/lib/node_modules/openclaw/node_modules/@matrix-org/matrix-sdk-crypto-nodejs
node download-lib.js

# 3. Clear crypto store cache
rm -f ~/.openclaw/matrix/accounts/*/crypto-idb-snapshot.json

# 4. Patch config for stability
python3 << 'EOF'
import json
with open('/Users/ahsan/.openclaw/openclaw.json', 'r') as f:
    config = json.load(f)

# Disable E2EE if crashes persist (optional)
config['channels']['matrix']['encryption'] = True  # or False for testing

# Reduce resource usage
config['agents']['defaults']['maxConcurrent'] = 1
config['agents']['defaults']['verboseDefault'] = 'off'

with open('/Users/ahsan/.openclaw/openclaw.json', 'w') as f:
    json.dump(config, f, indent=2)
EOF

# 5. Create optimized launchd plist with throttle
cat > ~/Library/LaunchAgents/ai.openclaw.gateway.patched.plist << 'PLIST'
<?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>ai.openclaw.gateway</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-c</string>
        <string>export NODE_OPTIONS="--max-old-space-size=2048" && openclaw gateway</string>
    </array>
    <key>EnvironmentVariables</key>
    <dict>
        <key>NODE_OPTIONS</key>
        <string>--max-old-space-size=2048</string>
    </dict>
    <key>ThrottleInterval</key>
    <integer>30</integer>
    <key>SoftResourceLimits</key>
    <dict>
        <key>NumberOfFiles</key>
        <integer>65536</integer>
        <key>ResidentSetSizeMax</key>
        <integer>2147483648</integer>
    </dict>
</dict>
</plist>
PLIST

# 6. Reload launchd
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist 2>/dev/null || true
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.patched.plist

echo "✅ Patch applied successfully"

---

// In download-lib.js
async function downloadWithRetry(url, dest, retries = 5) {
  for (let i = 0; i < retries; i++) {
    await download(url, dest);
    const stats = fs.statSync(dest);
    const expectedSize = await getExpectedSize(url);
    
    if (stats.size >= expectedSize * 0.95) {
      console.log(`✓ Download complete: ${(stats.size / 1024 / 1024).toFixed(2)} MB`);
      return;
    }
    
    console.warn(`⚠ Download incomplete (${stats.size} < ${expectedSize}), retrying... (${i + 1}/${retries})`);
    fs.unlinkSync(dest);
  }
  throw new Error(`Failed to download complete binary after ${retries} attempts`);
}

---

// Add post-install verification
async function verifyCodeSignature(binaryPath) {
  if (process.platform === 'darwin' && process.arch === 'arm64') {
    const { exec } = require('child_process');
    return new Promise((resolve, reject) => {
      exec(`codesign -verify "${binaryPath}"`, (error) => {
        if (error) {
          console.error('❌ Code signing verification failed');
          console.error('Please re-download the binary or contact support');
          reject(error);
        } else {
          console.log('✓ Code signing verified');
          resolve();
        }
      });
    });
  }
}

---

// Add memory/CPU monitoring in gateway
setInterval(() => {
  const usage = process.memoryUsage();
  const memMB = (usage.heapUsed / 1024 / 1024).toFixed(2);
  
  if (usage.heapUsed > 1.5 * 1024 * 1024 * 1024) { // 1.5GB
    console.warn(`⚠ High memory usage: ${memMB} MB`);
    // Trigger GC or graceful restart
  }
}, 30000);

---

<!-- Include in installer for macOS -->
<key>ThrottleInterval</key>
<integer>30</integer>
<key>EnvironmentVariables</key>
<dict>
    <key>NODE_OPTIONS</key>
    <string>--max-old-space-size=2048</string>
</dict>
<key>SoftResourceLimits</key>
<dict>
    <key>ResidentSetSizeMax</key>
    <integer>2147483648</integer>
</dict>

---

// Add to gateway startup
if (process.platform === 'darwin' && process.arch === 'arm64') {
  console.log('🍎 macOS ARM64 detected');
  console.log('⚠ Running Apple Silicon compatibility checks...');
  
  // Check crypto module integrity
  const cryptoPath = require.resolve('@matrix-org/matrix-sdk-crypto-nodejs');
  const stats = fs.statSync(cryptoPath);
  if (stats.size < 10 * 1024 * 1024) { // < 10MB
    console.error('❌ Crypto module appears incomplete (< 10MB)');
    console.error('Run: node download-lib.js in the module directory');
    process.exit(1);
  }
  
  console.log('✓ ARM64 compatibility checks passed');
}
RAW_BUFFERClick to expand / collapse

Bug type

Crash (process/app exits or hangs)

Beta release blocker

No

Summary

Bug Description

The OpenClaw gateway crashes within seconds of startup on macOS ARM64 (Apple Silicon M1/M2/M3) Macs. The crashes are caused by a combination of:

  1. Code Signing Issues with @matrix-org/matrix-sdk-crypto-nodejs native module
  2. Resource Exhaustion (CPU spikes to 95%, memory leaks to 1.5GB+)
  3. launchd Throttle misidentifying restarts as crash loop

📋 Environment

  • OS: macOS 26.4 (Apple Silicon ARM64)
  • Hardware: MacBook Air M1/M2/M3
  • Node.js: v22.22.2
  • OpenClaw: 2026.3.31
  • @matrix-org/matrix-sdk-crypto-nodejs: 0.4.0

🔍 Root Causes Identified

1. Code Signing Invalid (SIGKILL)

{
  "signal": "SIGKILL (Code Signature Invalid)",
  "termination": {
    "namespace": "CODESIGNING",
    "indicator": "Invalid Page"
  },
  "ktriageinfo": "VM - A memory corruption was found in executable text"
}

Affected Module: matrix-sdk-crypto.darwin-arm64.node

The native crypto module binary fails macOS code signing verification, causing the kernel to kill the process.

2. Incomplete Binary Download

Expected size: ~22 MB
Actual size: ~11 MB (50% incomplete)

The download-lib.js script sometimes downloads truncated binaries, triggering SIGBUS when memory-mapped.

3. Resource Exhaustion

CPU: 95% average (limit: 50%)
Memory: 366MB → 1.5GB+ (memory leak)
Duration: 90 seconds before termination

The gateway process exceeds macOS resource limits and gets terminated.

4. launchd Throttle Issue

launchd misidentifies frequent restarts as crash loop
After 4 quick exits within 5-10 minutes, service is automatically unloaded

Steps to reproduce

Steps to Reproduce

  1. Install OpenClaw on macOS ARM64:

    npm install -g openclaw@latest
  2. Configure Matrix channel with E2EE:

    {
      "channels": {
        "matrix": {
          "encryption": true
        }
      }
    }
  3. Start gateway:

    openclaw gateway
  4. Expected: Gateway runs stably

  5. Actual: Gateway crashes within 10-60 seconds

Expected behavior

Expected: Gateway runs stably

Actual behavior

Actual: Gateway crashes within 10-60 seconds

OpenClaw version

2026.3.31

Operating system

macOS 26.4 (Apple Silicon ARM64)

Install method

brew

Model

/minimax-2.5

Provider / routing chain

aws-bedrock

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

Workaround / Patch

A community patch has been developed that resolves these issues:

Patch Script

#!/bin/bash
# OpenClaw MacBook ARM64 Gateway Patch
# https://github.com/openclaw/openclaw/issues/[ISSUE_NUMBER]

set -e

# 1. Stop existing gateway
pkill -9 -f 'openclaw-gateway' || true

# 2. Re-download crypto module (fixes truncated binary)
cd ~/.nvm/versions/node/*/lib/node_modules/openclaw/node_modules/@matrix-org/matrix-sdk-crypto-nodejs
node download-lib.js

# 3. Clear crypto store cache
rm -f ~/.openclaw/matrix/accounts/*/crypto-idb-snapshot.json

# 4. Patch config for stability
python3 << 'EOF'
import json
with open('/Users/ahsan/.openclaw/openclaw.json', 'r') as f:
    config = json.load(f)

# Disable E2EE if crashes persist (optional)
config['channels']['matrix']['encryption'] = True  # or False for testing

# Reduce resource usage
config['agents']['defaults']['maxConcurrent'] = 1
config['agents']['defaults']['verboseDefault'] = 'off'

with open('/Users/ahsan/.openclaw/openclaw.json', 'w') as f:
    json.dump(config, f, indent=2)
EOF

# 5. Create optimized launchd plist with throttle
cat > ~/Library/LaunchAgents/ai.openclaw.gateway.patched.plist << 'PLIST'
<?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>ai.openclaw.gateway</string>
    <key>ProgramArguments</key>
    <array>
        <string>/bin/bash</string>
        <string>-c</string>
        <string>export NODE_OPTIONS="--max-old-space-size=2048" && openclaw gateway</string>
    </array>
    <key>EnvironmentVariables</key>
    <dict>
        <key>NODE_OPTIONS</key>
        <string>--max-old-space-size=2048</string>
    </dict>
    <key>ThrottleInterval</key>
    <integer>30</integer>
    <key>SoftResourceLimits</key>
    <dict>
        <key>NumberOfFiles</key>
        <integer>65536</integer>
        <key>ResidentSetSizeMax</key>
        <integer>2147483648</integer>
    </dict>
</dict>
</plist>
PLIST

# 6. Reload launchd
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist 2>/dev/null || true
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/ai.openclaw.gateway.patched.plist

echo "✅ Patch applied successfully"
<head></head><h3 data-heading="Patch Results" style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">Patch Results</h3> Metric | Before Patch | After Patch -- | -- | -- Uptime | <10s | 120s+ (stable) Memory | 366MB → 1.5GB+ | ~300MB (stable) CPU | 95% spike | 0.0% (idle) E2EE | ❌ Crashes | ✅ Working Status | ❌ Unusable | ✅ Production Ready <h2 data-heading="📝 Additional Context" style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">📝 Additional Context</h2><ul style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><li><strong>Related Issues:</strong><span class="Apple-converted-space"> </span>#44656, #19138</li><li><strong>Affected Users:</strong><span class="Apple-converted-space"> </span>All macOS ARM64 (M1/M2/M3) users</li><li><strong>Severity:</strong><span class="Apple-converted-space"> </span>High (gateway completely unusable without patch)</li><li><strong>Workaround Available:</strong><span class="Apple-converted-space"> </span>Yes (see patch above)</li></ul><h2 data-heading="🎯 Acceptance Criteria" style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">🎯 Acceptance Criteria</h2><ul class="contains-task-list" style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><li class="task-list-item" data-task=" "><input class="task-list-item-checkbox" type="checkbox">Gateway runs stable for 5+ minutes on macOS ARM64</li><li class="task-list-item" data-task=" "><input class="task-list-item-checkbox" type="checkbox">Memory usage stays below 500MB</li><li class="task-list-item" data-task=" "><input class="task-list-item-checkbox" type="checkbox">CPU usage stays below 50%</li><li class="task-list-item" data-task=" "><input class="task-list-item-checkbox" type="checkbox">E2EE works without crashes</li><li class="task-list-item" data-task=" "><input class="task-list-item-checkbox" type="checkbox">launchd doesn't unload service after restarts</li><li class="task-list-item" data-task=" "><input class="task-list-item-checkbox" type="checkbox">Crypto module downloads completely with verification</li></ul><h2 data-heading="🔗 References" style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;">🔗 References</h2><ul style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><li><a href="https://github.com/openclaw/openclaw/issues/44656" class="external-link" target="_blank" rel="noopener nofollow" aria-label="https://github.com/openclaw/openclaw/issues/44656" data-tooltip-position="top">OpenClaw Issue #44656</a><span class="Apple-converted-space"> </span>- Gateway crashes with SIGBUS</li><li><a href="https://github.com/openclaw/openclaw/issues/19138" class="external-link" target="_blank" rel="noopener nofollow" aria-label="https://github.com/openclaw/openclaw/issues/19138" data-tooltip-position="top">OpenClaw Issue #19138</a><span class="Apple-converted-space"> </span>- macOS launchd crash loop</li><li><a href="https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs" class="external-link" target="_blank" rel="noopener nofollow" aria-label="https://github.com/matrix-org/matrix-rust-sdk-crypto-nodejs" data-tooltip-position="top">Matrix Rust SDK Crypto NodeJS</a></li><li><a href="https://developer.apple.com/documentation/security/code-signing" class="external-link" target="_blank" rel="noopener nofollow" aria-label="https://developer.apple.com/documentation/security/code-signing" data-tooltip-position="top">Apple Code Signing Documentation</a></li></ul><hr style="font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><p style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><strong>Reported by:</strong><span class="Apple-converted-space"> </span>[Your Name]<br><strong>Date:</strong><span class="Apple-converted-space"> </span>2026-04-01<br><strong>OpenClaw Version:</strong><span class="Apple-converted-space"> </span>2026.3.31<br><strong>Platform:</strong><span class="Apple-converted-space"> </span>macOS ARM64 (Apple Silicon)</p><pre style="caret-color: rgb(255, 255, 255); color: rgb(255, 255, 255); font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-line: none; text-decoration-thickness: auto; text-decoration-style: solid;"><code> ---

📋 How to Submit

  1. Go to: https://github.com/openclaw/openclaw/issues/new
  2. Copy the issue body above
  3. Paste into the issue description
  4. Add labels: bug, macos, arm64, e2ee, gateway
  5. Submit

🔗 Full Patch Script

The complete patch script is available at: ~/Documents/Obsidian/OpenClaw/05-MacBook-Setup/patch-openclaw-macbook.sh


This issue will help the OpenClaw team understand and fix the macOS ARM64 stability problems for all users! 🦞

</code></pre><br class="Apple-interchange-newline">### Patch Results

MetricBefore PatchAfter Patch
Uptime<10s120s+ (stable)
Memory366MB → 1.5GB+~300MB (stable)
CPU95% spike0.0% (idle)
E2EE❌ Crashes✅ Working
Status❌ Unusable✅ Production Ready

🛠️ Suggested Fixes for OpenClaw Core

1. Improve Crypto Module Download

// In download-lib.js
async function downloadWithRetry(url, dest, retries = 5) {
  for (let i = 0; i < retries; i++) {
    await download(url, dest);
    const stats = fs.statSync(dest);
    const expectedSize = await getExpectedSize(url);
    
    if (stats.size >= expectedSize * 0.95) {
      console.log(`✓ Download complete: ${(stats.size / 1024 / 1024).toFixed(2)} MB`);
      return;
    }
    
    console.warn(`⚠ Download incomplete (${stats.size} < ${expectedSize}), retrying... (${i + 1}/${retries})`);
    fs.unlinkSync(dest);
  }
  throw new Error(`Failed to download complete binary after ${retries} attempts`);
}

2. Add macOS ARM64 Code Signing Verification

// Add post-install verification
async function verifyCodeSignature(binaryPath) {
  if (process.platform === 'darwin' && process.arch === 'arm64') {
    const { exec } = require('child_process');
    return new Promise((resolve, reject) => {
      exec(`codesign -verify "${binaryPath}"`, (error) => {
        if (error) {
          console.error('❌ Code signing verification failed');
          console.error('Please re-download the binary or contact support');
          reject(error);
        } else {
          console.log('✓ Code signing verified');
          resolve();
        }
      });
    });
  }
}

3. Add Resource Monitoring

// Add memory/CPU monitoring in gateway
setInterval(() => {
  const usage = process.memoryUsage();
  const memMB = (usage.heapUsed / 1024 / 1024).toFixed(2);
  
  if (usage.heapUsed > 1.5 * 1024 * 1024 * 1024) { // 1.5GB
    console.warn(`⚠ High memory usage: ${memMB} MB`);
    // Trigger GC or graceful restart
  }
}, 30000);

4. Improve launchd Configuration

<!-- Include in installer for macOS -->
<key>ThrottleInterval</key>
<integer>30</integer>
<key>EnvironmentVariables</key>
<dict>
    <key>NODE_OPTIONS</key>
    <string>--max-old-space-size=2048</string>
</dict>
<key>SoftResourceLimits</key>
<dict>
    <key>ResidentSetSizeMax</key>
    <integer>2147483648</integer>
</dict>

5. Add ARM64-Specific Startup Checks

// Add to gateway startup
if (process.platform === 'darwin' && process.arch === 'arm64') {
  console.log('🍎 macOS ARM64 detected');
  console.log('⚠ Running Apple Silicon compatibility checks...');
  
  // Check crypto module integrity
  const cryptoPath = require.resolve('@matrix-org/matrix-sdk-crypto-nodejs');
  const stats = fs.statSync(cryptoPath);
  if (stats.size < 10 * 1024 * 1024) { // < 10MB
    console.error('❌ Crypto module appears incomplete (< 10MB)');
    console.error('Run: node download-lib.js in the module directory');
    process.exit(1);
  }
  
  console.log('✓ ARM64 compatibility checks passed');
}

📊 Test Results

Patch Testing

TestDurationStatusNotes
No E2EE60s✅ StableMemory: 309MB
E2EE Enabled120s✅ StableMemory: ~300MB
Extended (5min)300s✅ StableNo crashes
CPU Load-✅ <5%Idle
Memory Leak-✅ NoneStable

📝 Additional Context

  • Related Issues: #44656, #19138
  • Affected Users: All macOS ARM64 (M1/M2/M3) users
  • Severity: High (gateway completely unusable without patch)
  • Workaround Available: Yes (see patch above)

🎯 Acceptance Criteria

  • Gateway runs stable for 5+ minutes on macOS ARM64
  • Memory usage stays below 500MB
  • CPU usage stays below 50%
  • E2EE works without crashes
  • launchd doesn't unload service after restarts
  • Crypto module downloads completely with verification

🔗 References


Reported by: [Your Name]
Date: 2026-04-01
OpenClaw Version: 2026.3.31
Platform: macOS ARM64 (Apple Silicon)


---

## 📋 How to Submit

1. **Go to:** https://github.com/openclaw/openclaw/issues/new
2. **Copy** the issue body above
3. **Paste** into the issue description
4. **Add labels:** `bug`, `macos`, `arm64`, `e2ee`, `gateway`
5. **Submit**

---

## 🔗 Full Patch Script

The complete patch script is available at:
`~/Documents/Obsidian/OpenClaw/05-MacBook-Setup/patch-openclaw-macbook.sh`

---

This issue will help the OpenClaw team understand and fix the macOS ARM64 stability problems for all users! 🦞

extent analysis

TL;DR

Apply the provided community patch script to resolve the OpenClaw gateway crashes on macOS ARM64.

Guidance

  1. Run the patch script: Execute the patch-openclaw-macbook.sh script to apply the necessary fixes, including re-downloading the crypto module, clearing the crypto store cache, and patching the config for stability.
  2. Verify the patch results: Check the gateway's uptime, memory usage, CPU usage, and E2EE functionality to ensure they meet the acceptance criteria.
  3. Monitor system resources: Keep an eye on memory and CPU usage to prevent resource exhaustion and ensure the gateway remains stable.
  4. Test with E2EE enabled: Validate that the gateway works correctly with end-to-end encryption enabled.

Example

The patch script includes steps like re-downloading the crypto module using download-lib.js, which can be modified to improve download reliability:

async function downloadWithRetry(url, dest, retries = 5) {
  for (let i = 0; i < retries; i++) {
    await download(url, dest);
    const stats = fs.statSync(dest);
    const expectedSize = await getExpectedSize(url);
    
    if (stats.size >= expectedSize * 0.95) {
      console.log(`✓ Download complete: ${(stats.size / 1024 / 1024).toFixed(2)} MB`);
      return;
    }
    
    console.warn(`⚠ Download incomplete (${stats.size} < ${expectedSize}), retrying... (${i + 1}/${retries})`);
    fs.unlinkSync(dest);
  }
  throw new Error(`Failed to download complete binary after ${retries} attempts`);
}

Notes

  • The patch script assumes a specific directory structure and file locations, so adjust the paths as needed.
  • The download-lib.js script should be reviewed and tested to ensure it correctly downloads the crypto module binary.

Recommendation

Apply the workaround by running the provided patch script, as it has been tested and shown to resolve the crashes and improve stability.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Expected: Gateway runs stably

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: [macOS ARM64] Gateway crashes on Apple Silicon (M1/M2/M3) - Code Signing + Resource Exhaustion [1 participants]