Guide - IA & Automatisation

Comment faire tourner l'agent IA OpenClaw 24h/24 sur un Mac Mini

OpenClaw est un agent IA open-source qui automatise des tâches via WhatsApp, Telegram, Discord et plus, propulsé par Claude ou GPT. Un Mac Mini M4 est l'hôte idéal : traitement Apple Silicon local, aucun surcoût GPU, et un tarif mensuel fixe à 85 $/mois.

25 min de lecture Mis à jour le 28 septembre 2026

1. Pourquoi utiliser un Mac Mini pour OpenClaw ?

Les VPS cloud facturent à la consommation et ajoutent des surcoûts GPU pour l'inférence IA. Un Mac Mini M4 vous offre de l'Apple Silicon dédié à un tarif fixe de 85 $/mois, sans surprises à la facturation, avec un accès SSH complet et la possibilité de faire tourner des LLM locaux en parallèle d'OpenClaw.

Fonctionnalité VPS cloud (tier IA) Mac Mini M4 (MyRemoteMac)
Coût mensuel Tarif tier GPU (variable) 85 $/mois (tarif fixe)
LLM locaux Surcoût / limité Natif (Ollama, llama.cpp)
Disponibilité 24h/24 Oui Oui (SLA 99,9 %)
Intégrations Apple Aucune iMessage, Raccourcis, Automator
Complexité de configuration Moyenne Faible (accès SSH inclus)
Confidentialité Datacenter partagé Matériel dédié

Avantage clé : Contrairement à un VPS cloud, votre Mac Mini M4 exécute Ollama ou llama.cpp nativement sur Apple Silicon. Vous pouvez router OpenClaw vers un LLM local pour les tâches sensibles, et utiliser Claude pour les requêtes complexes, sans payer au token.

2. Prérequis

Avant de commencer, assurez-vous d'avoir les éléments suivants :

  • Un serveur Mac Mini M4 (à partir de 85 $/mois) ou Mac mini M6 (à partir de 149 $/mois) chez MyRemoteMac
  • Un accès SSH à votre Mac Mini (fourni avec votre abonnement MyRemoteMac)
  • Une clé API Anthropic (pour Claude), obtenez-en une sur console.anthropic.com
  • Un compte de messagerie sur Telegram, Discord ou WhatsApp pour connecter votre agent
  • Des notions de base en ligne de commande et en édition d'un fichier de configuration JSON5 (~/.openclaw/openclaw.json)

3. Étape 1 : Connexion au Mac Mini et installation de Node.js

Commencez par vous connecter en SSH à votre Mac Mini M4. Vous avez reçu vos identifiants lors de la configuration de votre serveur MyRemoteMac.

Connexion via 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
# ProductName:    macOS
# ProductVersion: 15.4

Installation de Node.js avec Homebrew

# 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

Installation d'une version supportée de Node.js (26.1+ ou 24.16+)

OpenClaw nécessite Node.js 26.1+ (recommandé) ou 24.16+, Node 22, 23 et 25 ne sont plus supportés depuis la version 2026.9.3. Homebrew est la méthode documentée sur macOS. Si vous préférez nvm, installez Node 26 (jamais --lts) et assurez-vous que nvm est initialisé dans ~/.zshrc, sinon openclaw ne sera pas dans votre 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

Vérification de l'installation

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

4. Étape 2 : Installation d'OpenClaw et configuration de la clé Claude

Une fois Node.js prêt, installez la CLI OpenClaw globalement, il n'existe pas d'installation locale à un projet. OpenClaw est distribué sous forme de package npm openclaw ; un installeur en une ligne (openclaw.ai/install.sh) est également disponible et provisionne Node 26 pour vous s'il est absent.

Installation d'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

Lancement de l'assistant d'onboarding

OpenClaw lit ses paramètres depuis ~/.openclaw/openclaw.json (JSON5). Ne l'écrivez pas à la main : l'assistant d'onboarding le crée, vous demande votre clé API Anthropic, vérifie l'accès aux modèles et enregistre le service launchd en une seule passe :

# 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

Collez votre clé depuis console.anthropic.com quand l'assistant vous la demande (ou passez-la avec --anthropic-api-key). Les identifiants de modèle exigent le préfixe du fournisseur : utilisez anthropic/claude-sonnet-5 pour les tâches complexes ou anthropic/claude-haiku-4-5 pour des réponses plus rapides et économiques, le modèle par défaut d'OpenClaw sur une installation neuve est anthropic/claude-opus-5-5.

Vérification de la Gateway et envoi d'un premier message

# 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)

5. Étape 3 : Connexion des canaux de messagerie

OpenClaw supporte Telegram, Discord, WhatsApp, iMessage, Slack, Signal, Microsoft Teams, Google Chat et plus de 20 autres canaux. Telegram est intégré d'origine et le plus rapide à mettre en place, créez un bot via @BotFather, ajoutez le token, puis approuvez votre premier message privé avec le code d'appairage que le bot vous renvoie :

# 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

Connexion Discord

Pour connecter un bot Discord, créez une application dans le Portail développeur Discord, activez le Message Content Intent (obligatoire) et invitez-le avec les scopes bot + applications.commands. Installez le plugin officiel, référencez le token depuis la variable d'environnement DISCORD_BOT_TOKEN et approuvez votre premier message privé :

# 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

6. Étape 4 : Lancement comme service launchd persistant

Pour un fonctionnement 24h/24, la Gateway OpenClaw doit démarrer automatiquement au boot et redémarrer en cas d'erreur. OpenClaw s'en charge lui-même : openclaw gateway install (ou le flag --install-daemon de l'Étape 2) enregistre un LaunchAgent launchd supervisé nommé ai.openclaw.gateway dans ~/Library/LaunchAgents/, n'écrivez jamais le plist à la main.

Installation du service Gateway

Si vous avez sauté --install-daemon à l'Étape 2, enregistrez le service maintenant. Désactivez ensuite la mise en veille de macOS pour que la Gateway survive aux coupures réseau de la veille de maintenance (recommandation officielle) :

# 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

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

Gestion du service

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

Vérification du service

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

Mise à jour d'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

7. Résolution des problèmes courants

La Gateway refuse de démarrer ou signale un décalage de version

Un ~/.openclaw/openclaw.json invalide (une seule clé inconnue suffit) empêche la Gateway de démarrer, et un changement de Node.js peut laisser la CLI et le service sur des versions différentes. Lancez le diagnostic intégré et réparez le service :

# 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

L'API Claude renvoie 401 Unauthorized

Votre clé API est absente, incorrecte ou votre compte Anthropic n'a plus de crédits. Vérifiez d'abord l'état du fournisseur depuis OpenClaw, puis testez la clé directement si nécessaire :

# 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

Le bot Telegram ne répond plus

Le token du bot a peut-être été révoqué, votre message privé attend encore l'approbation d'appairage, ou la Gateway s'est arrêtée. Sondez le canal, approuvez les appairages en attente et redémarrez :

# 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)

Le bot devient silencieux après quelques heures sur macOS

La veille de maintenance de macOS peut couper le réseau (ENETDOWN) et rendre les canaux muets jusqu'à ce que vous touchiez au Mac. Désactivez la veille, consultez les logs de stabilité, surveillez les alertes de pression mémoire et ajoutez le watchdog launchd officiel :

# 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

8. Analyse des coûts vs VPS cloud

Voici une comparaison réaliste des coûts pour faire tourner un agent IA 24h/24 à différents niveaux d'utilisation :

Cas d'usage Appels IA/mois Coût VPS cloud Coût MyRemoteMac Économies mensuelles
Assistant personnel ~500 appels 120 $/mois (VPS GPU basique) 85 $/mois 45 $/mois
Bot pour petite équipe ~5 000 appels 200 $/mois 85 $/mois 125 $/mois
LLM local + agent Illimité (local) 350+ $/mois (VPS GPU) 85 $/mois 275+ $/mois
Système multi-agents 10 000+ appels 600+ $/mois 229 $/mois (M4 Pro) 371+ $/mois

En résumé : Faire tourner OpenClaw sur un Mac Mini M4 est nettement moins cher qu'un VPS cloud GPU. Vous bénéficiez également de l'Apple Silicon natif pour les LLM locaux via Ollama, routez les tâches non sensibles vers un modèle local (openclaw models set ollama/gemma4) et pointez le heartbeat intégré de 30 minutes vers anthropic/claude-haiku-4-5 pour maintenir au plus bas la facture API en période d'inactivité.

Sources (documentation officielle OpenClaw)

Guides associés

Prêt à faire tourner votre agent IA 24h/24 ?

Déployez un Mac Mini M4 dédié comme hôte OpenClaw. À partir de 85 $/mois.

Besoin de plus de détails ?

Parcourez la documentation complète : guides pas à pas, références de configuration et dépannage.

Ouvrir la documentation →