Headless Mac mini AI server: from toy to production
Описание и применение
Настройка Mac mini в качестве автономного AI‑сервера требует отключения сна, использования launchd для управления процессами и ограничения параллелизма в n8n.
Задача
Running a headless Mac mini as an AI server caused reliability issues—sleep, power management, and lack of proper service orchestration—leading to downtime and debugging headaches.
Результат
The Mac mini reliably ran as a background AI server, with no unexpected sleep, stable process restarts, and controlled concurrency for n8n workflows.
Рабочий процесс
- 1. Disable system sleep with
sudo pmset -a sleep 0and monitor assertions withpmset -g assertions. 2. Wrap long‑running processes withcaffeinate -ito prevent idle sleep. 3. Create a launchd plist (e.g., com.example.aihelper.plist) with ProgramArguments, KeepAlive, WatchPaths, and RunAtLoad. 4. Load the plist usinglaunchctl loadorlaunchctl bootstrap. 5. Tail logs withtail -f /tmp/aihelper.out.log /tmp/aihelper.err.log. 6. Configure n8n concurrency viaN8N_CONCURRENCY_PRODUCTION_LIMIT=20and enable queue mode for production workloads.
Доказательства
If you don't explicitly manage power behavior, you're not running a server. You're running a desktop that occasionally pretends to be one.
A practical pattern is: caffeinate -i ollama serve
Launchd is the real primitive for macOS services
- Дата записи: 2026-09-21T14:30:36.376Z