Panduan - AI & Otomatisasi

Cara Menjalankan Agen AI OpenClaw 24/7 di Mac Mini

OpenClaw adalah agen AI open-source yang mengotomatiskan tugas melalui WhatsApp, Telegram, Discord, dan lainnya — didukung oleh Claude atau GPT. Mac Mini M4 adalah host always-on yang ideal: pemrosesan Apple Silicon lokal, tanpa biaya tambahan GPU, dan biaya tetap $85/bulan.

Baca 25 menit Diperbarui Maret 2026

1. Mengapa Menjalankan OpenClaw di Mac Mini?

Penyedia VPS cloud menagih berdasarkan waktu komputasi dan menambahkan biaya tambahan GPU untuk inferensi AI. Mac Mini M4 memberi Anda Apple Silicon khusus dengan biaya tetap $85/bulan — tanpa kejutan bayar-per-panggilan, akses SSH penuh, dan kemampuan menjalankan LLM lokal bersama OpenClaw dengan biaya inferensi mendekati nol.

Fitur VPS Cloud (tingkat AI) Mac Mini M4 (MyRemoteMac)
Biaya Bulanan $150–$400/bln (VPS GPU) $85/bln (tarif tetap)
Dukungan LLM Lokal Biaya tambahan / terbatas Native (Ollama, llama.cpp)
Uptime Selalu Aktif Ya Ya (SLA 99.9%)
Integrasi Apple Tidak ada iMessage, Shortcuts, Automator
Kompleksitas Pengaturan Sedang Rendah (termasuk akses SSH)
Privasi Datacenter bersama Hardware khusus

Keunggulan Utama: Tidak seperti VPS cloud, Mac Mini M4 Anda menjalankan Ollama atau llama.cpp secara native di Apple Silicon. Anda dapat mengarahkan OpenClaw ke LLM lokal untuk tugas sensitif, lalu beralih ke Claude untuk kueri kompleks — semuanya tanpa membayar per token.

2. Prasyarat

Sebelum memulai, pastikan Anda memiliki hal-hal berikut:

  • Sebuah server Mac Mini M4 dari MyRemoteMac (mulai $85/bln)
  • Akses SSH ke Mac Mini Anda (disediakan bersama langganan MyRemoteMac Anda)
  • Sebuah kunci API Anthropic (untuk Claude) — dapatkan di console.anthropic.com
  • Akun perpesanan di Telegram, Discord, atau WhatsApp untuk menghubungkan agen Anda
  • Pemahaman dasar tentang perintah terminal dan file konfigurasi JSON

3. Langkah 1: Hubungkan ke Mac Mini Anda dan Instal Node.js

Pertama, SSH ke Mac Mini M4 Anda. Anda akan menerima kredensial saat menyiapkan server MyRemoteMac Anda.

Hubungkan melalui SSH

# Connect to your Mac Mini M4
ssh admin@your-server-ip

# Verify you're on Apple Silicon
uname -m
# Expected output: arm64

# Check macOS version
sw_vers
# ProductName:    macOS
# ProductVersion: 15.4

Instal nvm (Node Version Manager)

# Install nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# Load nvm into the current session
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

# Verify nvm is available
nvm --version
# 0.39.7

Instal Node.js LTS

Kami merekomendasikan nvm untuk mengelola versi Node.js — ini menghindari masalah izin dan membuat peningkatan menjadi mudah:

# Install the latest LTS version of Node.js
nvm install --lts

# Set it as the default for new sessions
nvm alias default node

# Verify the installation
node --version
# v22.x.x
npm --version
# 10.x.x

Verifikasi Instalasi

# Confirm Node.js is running on Apple Silicon
node -e "console.log(process.platform, process.arch)"
# darwin arm64

# Note the exact Node.js binary path (needed for launchd in Step 4)
which node
# /Users/admin/.nvm/versions/node/v22.14.0/bin/node

4. Langkah 2: Instal OpenClaw dan Konfigurasikan Kunci API Claude

Dengan Node.js siap, instal OpenClaw di direktori proyek khusus. OpenClaw didistribusikan sebagai paket npm.

Instal OpenClaw

# Create a directory for your OpenClaw agent
mkdir -p ~/openclaw
cd ~/openclaw

# Initialize a Node.js project
npm init -y

# Install OpenClaw
npm install openclaw

# Create the logs directory
mkdir -p logs

Buat File Konfigurasi

OpenClaw membaca pengaturannya dari file config.json. Buat satu di direktori proyek Anda:

# Create config.json in your project directory
cat > ~/openclaw/config.json << 'EOF'
{
  "model": "claude-sonnet-4-6",
  "apiKey": "sk-ant-YOUR_API_KEY_HERE",
  "channels": {
    "telegram": {
      "enabled": true,
      "token": "YOUR_TELEGRAM_BOT_TOKEN"
    }
  },
  "maxHistory": 20,
  "systemPrompt": "You are a helpful assistant. Be concise and accurate."
}
EOF

Ganti sk-ant-YOUR_API_KEY_HERE dengan kunci asli Anda dari console.anthropic.com. Anda dapat menggunakan claude-sonnet-4-6 untuk tugas kompleks atau claude-haiku-4-5 untuk respons yang lebih cepat dan lebih murah.

Uji Agen secara Interaktif

# Start OpenClaw in interactive mode to test it
cd ~/openclaw
npx openclaw start --config ./config.json

# Expected output:
# [OpenClaw] Agent initialized with model: claude-sonnet-4-6
# [OpenClaw] Telegram channel connected
# [OpenClaw] Listening for messages...

# Press Ctrl+C to stop (you will set up the persistent service in Step 4)

5. Langkah 3: Hubungkan Saluran Perpesanan

OpenClaw mendukung Telegram, Discord, WhatsApp, iMessage, Slack, dan Signal. Saluran yang paling mudah disiapkan adalah Telegram — buat bot melalui @BotFather:

# Step 1: Open Telegram and search for @BotFather
# Step 2: Send /newbot and follow the prompts
# Step 3: Copy the token (format: 1234567890:AAF...)

# Test your bot token is valid:
curl -s "https://api.telegram.org/botYOUR_TOKEN/getMe"
# {"ok":true,"result":{"id":...,"first_name":"My Agent","username":"myagent_bot",...}}

Hubungkan Discord

Untuk menghubungkan bot Discord, buat aplikasi di Discord Developer Portal dan berikan izin yang diperlukan:

# In Discord Developer Portal (https://discord.com/developers/applications):
# 1. Create a New Application and give it a name
# 2. Go to Bot > Add Bot
# 3. Copy the Bot Token
# 4. Enable "Message Content Intent" under Privileged Gateway Intents
# 5. Under OAuth2 > URL Generator, select bot + Send Messages + Read Message History
# 6. Use the generated URL to invite the bot to your server

# Update your config.json to enable Discord:
# "discord": { "enabled": true, "token": "YOUR_DISCORD_BOT_TOKEN" }

6. Langkah 4: Jalankan sebagai Layanan launchd Persisten

Untuk operasi 24/7, OpenClaw harus memulai secara otomatis saat boot dan memulai ulang saat gagal. macOS menggunakan launchd untuk tujuan ini — buat plist layanan di ~/Library/LaunchAgents/.

Buat Plist launchd

Simpan berikut ini sebagai ~/openclaw/com.openclaw.agent.plist (ganti admin dengan nama pengguna asli Anda dan sesuaikan path Node.js dari Langkah 1):

<?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.agent</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/admin/.nvm/versions/node/v22.14.0/bin/node</string>
        <string>/Users/admin/openclaw/node_modules/.bin/openclaw</string>
        <string>start</string>
        <string>--config</string>
        <string>/Users/admin/openclaw/config.json</string>
    </array>
    <key>WorkingDirectory</key>
    <string>/Users/admin/openclaw</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>StandardOutPath</key>
    <string>/Users/admin/openclaw/logs/openclaw.log</string>
    <key>StandardErrorPath</key>
    <string>/Users/admin/openclaw/logs/openclaw-error.log</string>
</dict>
</plist>

Aktifkan dan Mulai Layanan

# Save the plist to the LaunchAgents directory
# (Use your actual username instead of "admin")
cp ~/openclaw/com.openclaw.agent.plist ~/Library/LaunchAgents/

# Load and start the service
launchctl load ~/Library/LaunchAgents/com.openclaw.agent.plist
launchctl start com.openclaw.agent

Verifikasi Layanan Berjalan

# Check that the service is running
launchctl list | grep openclaw
# 12345   0   com.openclaw.agent
# (First column is the PID — a number means it's running)

# View live logs
tail -f ~/openclaw/logs/openclaw.log

# View error logs
tail -f ~/openclaw/logs/openclaw-error.log

Perbarui OpenClaw (Tanpa Downtime)

# Stop the service before updating
launchctl stop com.openclaw.agent

# Update OpenClaw to the latest version
cd ~/openclaw
npm update openclaw

# Restart the service
launchctl start com.openclaw.agent

# Confirm the new version is running
tail -5 ~/openclaw/logs/openclaw.log

7. Pemecahan Masalah Umum

Layanan gagal memulai: "Cannot find module"

Path absolut Node.js dalam plist salah, atau paket npm hilang. Periksa log error dan instal ulang:

# Check the error logs
cat ~/openclaw/logs/openclaw-error.log | tail -20

# Make sure to use the absolute Node.js binary path in the plist
which node
# /Users/admin/.nvm/versions/node/v22.14.0/bin/node

# Reinstall dependencies
cd ~/openclaw
npm install

API Claude mengembalikan 401 Unauthorized

Kunci API Anda hilang, salah, atau akun Anthropic Anda tidak memiliki sisa kredit. Verifikasi kunci:

# Test your API key directly
curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-haiku-4-5","max_tokens":10,"messages":[{"role":"user","content":"Hi"}]}'

# Expected: {"id":"msg_...","type":"message",...}
# If you get 401: check your key at console.anthropic.com

Bot Telegram berhenti merespons

Token bot mungkin telah dicabut atau layanan mengalami crash. Periksa token dan mulai ulang:

# Verify the bot token is still valid
curl -s "https://api.telegram.org/botYOUR_TOKEN/getMe"

# Restart the service
launchctl stop com.openclaw.agent
launchctl start com.openclaw.agent

# If the token was revoked, generate a new one via @BotFather (/mybots > API Token)

Penggunaan memori tinggi setelah beberapa hari

OpenClaw mengakumulasi riwayat percakapan dalam memori. Turunkan maxHistory di config.json dan jadwalkan restart mingguan:

# Reduce conversation history in config.json
# "maxHistory": 10  (default is 20 — lower values use less memory)

# Set up a weekly restart via cron
crontab -e
# Add this line to restart OpenClaw every Sunday at 3am:
# 0 3 * * 0 launchctl stop com.openclaw.agent; sleep 2; launchctl start com.openclaw.agent

# Monitor memory usage
ps aux | grep openclaw

8. Analisis Biaya vs. VPS Cloud

Berikut adalah perbandingan biaya realistis untuk menjalankan agen AI 24/7 pada berbagai tingkat penggunaan:

Kasus Penggunaan Panggilan AI/Bulan Biaya VPS Cloud Biaya MyRemoteMac Penghematan Bulanan
Asisten pribadi ~500 panggilan $120/bln (VPS GPU dasar) $85/bln $45/bln
Bot tim kecil ~5,000 panggilan $200/bln $85/bln $125/bln
LLM lokal + agen Tanpa batas (lokal) $350+/bln (VPS GPU) $85/bln $275+/bln
Sistem multi-agen 10,000+ panggilan $600+/bln $229/bln (M4 Pro) $371+/bln

Kesimpulan: Menjalankan OpenClaw di Mac Mini M4 jauh lebih murah daripada VPS AI cloud mana pun. Anda juga mendapatkan Apple Silicon native untuk LLM lokal melalui Ollama — arahkan tugas non-sensitif ke model lokal gratis dan hemat lebih banyak lagi pada biaya API.

Panduan Terkait

Siap Menjalankan Agen AI Anda 24/7?

Deploy Mac Mini M4 khusus sebagai host OpenClaw Anda. Mulai dari $85/bulan.

Butuh detail lebih lanjut?

Jelajahi dokumentasi lengkap untuk panduan langkah demi langkah, referensi konfigurasi, dan pemecahan masalah.

Buka dokumentasi →