本文へスキップ

Mac MiniでOpenClaw AIエージェントを24時間365日稼働させる方法

OpenClawは、WhatsApp、Telegram、Discordなどを介してタスクを自動化するオープンソースのAIエージェントで、ClaudeまたはGPTを利用します。Mac mini M4は、常時稼働のホストとして理想的です。ローカルのApple Siliconによる処理、GPU追加料金ゼロ、そしてマシン代は月額$85の定額(USD・税抜)です。ClaudeやGPTのAPI利用料は、各プロバイダーから別途請求されます。

AIと自動化 読了25分 2026年10月13日更新

なぜMac MiniでOpenClawを実行するのか?

クラウドVPSプロバイダーは、コンピューティング時間に応じて課金し、AI推論にはGPU追加料金を上乗せします。Mac mini M4なら、月額$85の定額(USD・税抜)で専用のApple Siliconを利用できます。フルSSHアクセスが可能で、OpenClawと並行してローカルLLMを実行し、推論コストをほぼゼロに抑えられます。ただし、Claudeなどのホスト型モデルへの呼び出しは、引き続き各プロバイダーからトークン単位で課金されます。

なぜMac MiniでOpenClawを実行するのか?
Mac Mini M4(My Remote Mac) クラウドVPS(AIプラン)
月額料金 $85/月(定額) GPUプランの料金(変動あり)
ローカルLLMのサポート ネイティブ対応(Ollama、llama.cpp) 追加料金/制限あり
常時稼働 対応(99.9% SLA) 対応
Apple連携 iMessage、ショートカット、Automator なし
セットアップの複雑さ 低(SSHアクセス込み) 中
プライバシー 専用ハードウェア 共有データセンター

My Remote Mac の料金は USD・税抜です。

主なメリット: クラウドVPSとは異なり、Mac mini M4はOllamaやllama.cppをApple Silicon上でネイティブに実行します。日常的なタスクや機密性の高いタスクはOpenClawからローカルLLMにルーティングすればトークン課金はかからず、複雑なクエリにはClaude(Anthropicがトークン単位で課金)を使えます。

前提条件

始める前に、以下が揃っていることを確認してください。

  • My Remote Mac の Mac Mini M4サーバー(月額$85から)または Mac mini M6(月額$149から)
  • Mac Miniへの SSHアクセス(My Remote Mac のサブスクリプションに付属)
  • Anthropic APIキー(Claude用)、console.anthropic.com で取得できます
  • エージェントを接続するための Telegram、Discord、またはWhatsApp のメッセージングアカウント
  • ターミナルコマンドと JSON5設定ファイル(~/.openclaw/openclaw.json)の編集に関する基本的な知識

ステップ1:Mac Miniに接続してNode.jsをインストールする

まず、Mac Mini M4にSSH接続します。認証情報は、My Remote Mac サーバーをセットアップした際に受け取っているはずです。

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 (official Node.js 24/26 macOS binaries need macOS 13.5+)
sw_vers -productVersion

HomebrewでNode.jsをインストールする

# Install Node.js 26 with Homebrew (documented method on macOS)
# Homebrew missing? /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node

# Must print v26.x (or v24.16+). Node 22, 23 and 25 are unsupported.
node --version
# v26.x.x
npm --version

サポート対象のNode.js(26.1以降または24.16以降)をインストールする

OpenClawには Node.js 26.1+(推奨)または24.16以降が必要です。Node 22、23、25はリリース2026.9.3以降サポートされていません。macOSではHomebrewが公式ドキュメントに記載された方法です。nvmを使いたい場合は、Node 26をインストールし(--lts は決して使わないでください)、nvmが ~/.zshrc で初期化されていることを確認してください。そうしないと openclaw がPATHに含まれません:

# Prefer nvm? Target Node 26: never --lts
nvm install 26
nvm alias default 26

# nvm must be initialised in ~/.zshrc, otherwise `openclaw` is not on PATH in new sessions
echo 'export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"' >> ~/.zshrc

インストールを確認する

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

ステップ2:OpenClawをインストールしてClaude APIキーを構成する

Node.jsの準備ができたら、OpenClaw CLIをグローバルにインストールします。プロジェクトローカルへのインストールはありません。OpenClawはnpmパッケージ openclaw として配布されています。ワンライナーのインストーラー(openclaw.ai/install.sh)も用意されており、Node 26が見つからない場合は自動的にインストールしてくれます。

OpenClawをインストールする

# Option A: one-line installer (provisions Node 26 if missing, then launches the wizard)
curl -fsSL https://openclaw.ai/install.sh | bash
# (append `-s -- --no-onboard` to skip the wizard)

# Option B: global npm install (you manage Node)
npm install -g openclaw@latest --allow-scripts=openclaw
# omit --allow-scripts on npm <= 11.15

openclaw --version
# 2026.9.6

オンボーディングウィザードを実行する

OpenClawは ~/.openclaw/openclaw.json(JSON5)から設定を読み込みます。このファイルを手書きで作成しないでください。オンボーディングウィザードがファイルの作成、Anthropic APIキーの入力、モデルアクセスの確認、launchdサービスの登録を一括で行います:

# Onboarding wizard + launchd service in one go
openclaw onboard --install-daemon

# Non-interactive over SSH (key from console.anthropic.com):
export ANTHROPIC_API_KEY="sk-ant-YOUR_API_KEY_HERE"
openclaw onboard --anthropic-api-key "$ANTHROPIC_API_KEY" --install-daemon

# Choose the default Claude model (provider/model format)
openclaw models set anthropic/claude-sonnet-5
# cheaper: openclaw models set anthropic/claude-haiku-4-5
openclaw models status

# Settings now live in ~/.openclaw/openclaw.json (JSON5). After any hand edit:
openclaw doctor --fix

ウィザードで求められたら、console.anthropic.com で取得したキーを貼り付けます(または --anthropic-api-key で渡します)。モデルIDにはプロバイダーのプレフィックスが必要です。複雑なタスクには anthropic/claude-sonnet-5 を、より高速で低コストな応答には anthropic/claude-haiku-4-5 を使用してください。新規セットアップ時のOpenClawのデフォルトは anthropic/claude-opus-5-5 です。

Gatewayを確認して最初のメッセージを送信する

# Check the Gateway service installed by --install-daemon
openclaw gateway status
# Runtime: running
# Connectivity probe: ok

# Send a first message through the running Gateway
openclaw agent --agent main --message "Hello, are you alive?"

# Control UI from your laptop, the Gateway stays loopback-only on 127.0.0.1:18789
ssh -N -L 18789:127.0.0.1:18789 admin@your-server-ip
# then open http://127.0.0.1:18789 (or run `openclaw dashboard` over VNC)

ステップ3:メッセージングチャネルを接続する

OpenClawは、Telegram、Discord、WhatsApp、iMessage、Slack、Signal、Microsoft Teams、Google Chatをはじめ、20以上のチャネルをサポートしています。Telegramは標準で同梱されており、最も早く動かせます。@BotFather でボットを作成し、トークンを追加してから、ボットが返してくるペアリングコードで最初のDMを承認します:

# 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",...}}

# Add the channel (Telegram is bundled: nothing to install)
openclaw channels add --channel telegram --token YOUR_TELEGRAM_BOT_TOKEN
openclaw channels status --probe

# DM your bot once: it answers with a pairing code. Approve it:
openclaw pairing approve telegram <CODE>

# Groups: disable Privacy Mode via BotFather (/setprivacy) or make the bot a group admin

Discordを接続する

Discordボットを接続するには、Discord Developer Portalでアプリケーションを作成し、Message Content Intent(必須)を有効にして、bot + applications.commands スコープで招待します。公式プラグインをインストールし、環境変数 DISCORD_BOT_TOKEN からトークンを参照して、最初のDMを承認します:

# In Discord Developer Portal (https://discord.com/developers/applications):
# 1. Create a New Application and give it a name
# 2. Open the Bot page, click Reset Token and copy the token (despite the name, it creates your first token)
# 3. Enable "Message Content Intent" (required) and "Server Members Intent" (recommended)
# 4. Under OAuth2 > URL Generator select scopes bot + applications.commands,
#    permissions View Channels, Send Messages, Read Message History, Embed Links, Attach Files
# 5. Use the generated URL to invite the bot to your server

# Install the official plugin and reference the token from an env var
openclaw plugins install @openclaw/discord
cat > ./discord.patch.json5 << 'EOF'
{ env: { vars: { DISCORD_BOT_TOKEN: "YOUR_DISCORD_BOT_TOKEN" } },
  channels: { discord: { enabled: true, token: { source: "env", provider: "default", id: "DISCORD_BOT_TOKEN" } } } }
EOF
openclaw config patch --file ./discord.patch.json5
rm ./discord.patch.json5   # the token now lives in ~/.openclaw/openclaw.json: do not leave a copy behind

# Approve your first DM
openclaw pairing approve discord <CODE>

# WhatsApp (optional, QR login, do it over VNC, use a separate number):
# openclaw plugins install @openclaw/whatsapp && openclaw channels login --channel whatsapp

ステップ4:永続的なlaunchdサービスとして実行する

24時間365日の稼働のためには、OpenClaw Gatewayが障害時に再起動し、マシンの再起動後にも復帰する必要があります。監視はOpenClaw自身が処理します。openclaw gateway install(またはステップ2の --install-daemon フラグ)が、ai.openclaw.gateway という名前の監視付きlaunchd LaunchAgentを ~/Library/LaunchAgents/ に登録します。plistを手書きで作成しないでください。LaunchAgentは起動時ではなく、ユーザーセッションの開始時に起動します。ヘッドレスのMac miniでは、管理者ユーザーの自動ログインを有効にし(システム設定 > ユーザとグループ。FileVaultがオンの間は利用できません)、一度再起動してGatewayが動作していることを確認してください。

Gatewayサービスをインストールする

ステップ2で --install-daemon をスキップした場合は、ここでサービスを登録します。次に、メンテナンススリープによるネットワークの断続的な切断にGatewayが耐えられるよう、macOSのスリープを無効にします(公式の推奨事項):

# Register the supervised LaunchAgent ai.openclaw.gateway
# (skip if you already ran `openclaw onboard --install-daemon`)
openclaw gateway install

# The plist lives at ~/Library/LaunchAgents/ai.openclaw.gateway.plist: do not edit it by hand
# LaunchAgents load at login: enable Automatic login so the Gateway returns after a reboot

# Keep the Mac awake: avoids maintenance-sleep network flaps (official recommendation)
sudo pmset -a sleep 0 disksleep 0 standby 0 powernap 0

サービスを管理する

openclaw gateway status --deep   # CLI vs service version, port, runtime
openclaw gateway restart         # never chain `stop` + `start` as a restart
openclaw gateway stop            # add --disable to keep it off across reboots
openclaw gateway install --runtime node --force   # retarget the service after a Node.js change

サービスが稼働していることを確認する

openclaw gateway status
# Runtime: running
# Connectivity probe: ok
openclaw gateway health

# Live logs
openclaw logs --follow
# Files: /tmp/openclaw/openclaw-YYYY-MM-DD.log and ~/Library/Logs/openclaw/gateway.log

# Raw launchd view (troubleshooting only)
launchctl print gui/$UID/ai.openclaw.gateway

OpenClawを更新する

# Back up your state first (automatic config copies are not a full backup)
cp -R ~/.openclaw ~/openclaw-backup-$(date +%F)

# Update: stages the package, validates config, runs doctor, restarts the Gateway
openclaw update
openclaw doctor
openclaw gateway restart
openclaw health

# Prefer the LTS-equivalent line (currently 2026.7.35):
# openclaw update --channel extended-stable

よくある問題のトラブルシューティング

Gatewayが起動しない、またはバージョン不一致が表示される

~/.openclaw/openclaw.json が無効だと(未知のキーが1つあるだけで十分です)、Gatewayは起動を拒否します。また、Node.jsを変更するとCLIとサービスのバージョンが食い違うことがあります。組み込みの診断を実行してサービスを修復します:

# Validate and auto-repair the config
openclaw doctor --fix

# CLI vs service version skew
openclaw gateway status --deep
openclaw logs --follow

# Re-register the service on the new Node.js after a runtime change
openclaw gateway install --runtime node --force

Claude APIが401 Unauthorizedを返す

APIキーが設定されていない、間違っている、またはAnthropicアカウントのクレジット残高がありません。まずOpenClawからプロバイダーのステータスを確認し、必要に応じてキーを直接テストします:

# Check provider auth from OpenClaw
openclaw models status
openclaw doctor

# Optional: test the 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

Telegramボットが応答しなくなる

ボットトークンが失効した、DMがまだペアリング承認待ちになっている、またはGatewayが停止した可能性があります。チャネルを調査し、保留中のペアリングを承認して再起動します:

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

# Probe the channel and approve any pending pairing
openclaw channels status --probe
openclaw pairing approve telegram <CODE>

# Restart the Gateway
openclaw gateway restart

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

macOSで数時間後にボットが沈黙する

macOSのメンテナンススリープによってネットワークが切断され(ENETDOWN)、Macを操作するまでチャネルが沈黙することがあります。スリープを無効にし、安定性ログを確認し、メモリプレッシャーの警告に注意して、公式のlaunchdウォッチドッグを追加します:

# Disable macOS maintenance sleep (ENETDOWN network flaps)
sudo pmset -a sleep 0 disksleep 0 standby 0 powernap 0

# Stability logs and memory-pressure warnings
ls ~/.openclaw/logs/stability/
grep -i "memory pressure" /tmp/openclaw/openclaw-$(date +%F).log

# Official liveness watchdog: re-arm launchd's respawn gate
launchctl kickstart -k gui/$UID/ai.openclaw.gateway

クラウドVPSとのコスト比較

以下は、さまざまな利用レベルでAIエージェントを24時間365日稼働させた場合の現実的なコスト比較です。

クラウドVPSとのコスト比較
ユースケース My Remote Mac のコスト AIコール数/月 クラウドVPSのコスト 月間の節約額
パーソナルアシスタント $85/月 約500コール $120/月(基本的なGPU VPS) $35/月
小規模チーム向けボット $85/月 約5,000コール $200/月 $115/月
ローカルLLM + エージェント $85/月 無制限(ローカル) $350以上/月(GPU VPS) $265以上/月
マルチエージェントシステム $229/月(M4 Pro) 10,000コール以上 $600以上/月 $371以上/月

My Remote Mac の料金は USD・税抜です。

結論: Mac Mini M4でOpenClawを実行すれば、GPUクラウドVPSよりも大幅に低コストです。さらに、Ollama経由でローカルLLMを動かせるネイティブなApple Siliconも手に入ります。機密性の低いタスクをローカルモデルにルーティングし(openclaw models set ollama/gemma4)、組み込みの30分ごとのハートビートを anthropic/claude-haiku-4-5 に向ければ、アイドル時のAPI費用を低く抑えられます。

出典(OpenClaw 公式ドキュメント)

AIエージェントを24時間365日稼働させる準備はできましたか?

専用のMac Mini M4をOpenClawのホストとして導入しましょう。月額$85から利用できます。

My Remote Mac の料金は USD・税抜です。

さらに詳しい情報をお探しですか?

ステップバイステップのセットアップ手順、設定リファレンス、トラブルシューティングについては、完全なドキュメントをご覧ください。

ドキュメントを開く →