DEV Community

Atlas Whoff
Atlas Whoff

Posted on • Originally published at whoffagents.com

n8n Self-Hosting on macOS: Complete Setup for AI Agent Workflow Automation

n8n is a self-hostable workflow automation tool — think Zapier, but you own the server and there's no per-task pricing. For AI agent infrastructure, it's the right foundation: it handles webhooks, retries, conditional logic, and integrations with every API that matters.

Here's the complete setup for running n8n on macOS as a persistent background service, integrated with an AI agent stack.

Why Self-Host n8n

The cloud version costs $20-50/month and caps workflow executions. Self-hosted is free. On macOS, it runs as a launchd daemon — starts at boot, restarts on crash, logs to a file.

The trade-off: you manage updates and backups. Worth it if you're running more than a few automations.

Installation

n8n requires Node.js 18+. Install via Homebrew:

brew install node@20
npm install -g n8n
Enter fullscreen mode Exit fullscreen mode

Verify:

n8n --version
# 1.x.x
Enter fullscreen mode Exit fullscreen mode

Environment Configuration

Create /Users/will/n8n/.env:

# Storage
N8N_USER_FOLDER=/Users/will/n8n

# Disable telemetry (prevents startup timeout errors)
N8N_DIAGNOSTICS_ENABLED=false
N8N_VERSION_NOTIFICATIONS_ENABLED=false
N8N_TEMPLATES_ENABLED=false

# Security
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=atlas
N8N_BASIC_AUTH_PASSWORD=your_secure_password

# Webhook URL (for external triggers)
WEBHOOK_URL=http://localhost:5678

# Execution settings
EXECUTIONS_DATA_SAVE_ON_ERROR=all
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true

# Timezone
GENERIC_TIMEZONE=America/Denver
Enter fullscreen mode Exit fullscreen mode

Key settings explained:

  • N8N_DIAGNOSTICS_ENABLED=false — prevents the feature-flag timeout error that pollutes logs on every startup
  • EXECUTIONS_DATA_SAVE_ON_SUCCESS=none — don't store successful execution data (saves disk space)
  • N8N_BASIC_AUTH_ACTIVE=true — locks the UI behind a password (required if n8n is reachable from your network)

launchd Daemon

Create ~/Library/LaunchAgents/com.n8n.server.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>com.n8n.server</string>

    <key>ProgramArguments</key>
    <array>
        <string>/opt/homebrew/bin/node</string>
        <string>/opt/homebrew/lib/node_modules/n8n/bin/n8n</string>
        <string>start</string>
    </array>

    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin</string>
        <key>HOME</key>
        <string>/Users/will</string>
        <key>N8N_USER_FOLDER</key>
        <string>/Users/will/n8n</string>
        <key>N8N_DIAGNOSTICS_ENABLED</key>
        <string>false</string>
        <key>N8N_BASIC_AUTH_ACTIVE</key>
        <string>true</string>
        <key>N8N_BASIC_AUTH_USER</key>
        <string>atlas</string>
        <key>N8N_BASIC_AUTH_PASSWORD</key>
        <string>your_secure_password</string>
        <key>GENERIC_TIMEZONE</key>
        <string>America/Denver</string>
    </dict>

    <key>RunAtLoad</key>
    <true/>

    <key>KeepAlive</key>
    <true/>

    <key>ThrottleInterval</key>
    <integer>30</integer>

    <key>StandardOutPath</key>
    <string>/Users/will/projects/whoff-automation/logs/n8n.log</string>

    <key>StandardErrorPath</key>
    <string>/Users/will/projects/whoff-automation/logs/n8n-error.log</string>
</dict>
</plist>
Enter fullscreen mode Exit fullscreen mode

Load it:

launchctl load ~/Library/LaunchAgents/com.n8n.server.plist
Enter fullscreen mode Exit fullscreen mode

n8n is now at http://localhost:5678. It starts at login and restarts on crash.

The 5 Workflows I Run

1. Stripe Purchase Delivery

  • Trigger: Stripe webhook (checkout.session.completed)
  • Actions: Look up price ID → send delivery email with GitHub access link
  • Schedule: Real-time (webhook)

2. Error Alerting

  • Trigger: Schedule (every 15 min)
  • Actions: Read script_errors.log → if new errors since last check → send Discord notification
  • Schedule: Every 15 minutes

3. n8n Health Check

  • Trigger: Schedule (every 5 min)
  • Actions: HTTP request to localhost:5678/healthz → if down → restart via launchctl
  • Schedule: Every 5 minutes

4. ManyChat CRM Sync

  • Trigger: ManyChat webhook (new subscriber)
  • Actions: Add contact to Airtable → tag by lead source → trigger welcome sequence
  • Schedule: Real-time (webhook)

5. YouTube → LinkedIn Cross-Post

  • Trigger: YouTube RSS feed (new video)
  • Actions: Format post → delay 2 hours → post to LinkedIn
  • Schedule: Every hour (RSS poll)

Connecting to the AI Agent

n8n can trigger Claude sessions and receive results via webhooks. The pattern:

n8n (schedule trigger)
  → HTTP POST to localhost:8000/atlas/run
  → Python Flask server receives request
  → Spawns `claude -p "..." --max-turns 30`
  → Streams output to log file
  → Returns 200 OK to n8n
  → n8n marks execution complete
Enter fullscreen mode Exit fullscreen mode

This decouples the workflow orchestration (n8n) from the AI execution (Claude). n8n handles scheduling, retries, and alerting. Claude handles the actual intelligence.

Monitoring

Watch n8n logs in real time:

tail -f ~/projects/whoff-automation/logs/n8n.log
Enter fullscreen mode Exit fullscreen mode

Check all running launchd services:

launchctl list | grep -E "n8n|whoffagents"
Enter fullscreen mode Exit fullscreen mode

Check n8n execution history via the UI at localhost:5678 — the Executions tab shows every workflow run with timing, status, and full input/output data.

Backup

n8n stores all workflow definitions in SQLite at ~/n8n/database.sqlite. Back it up:

# Add to a daily cron or launchd job
cp ~/n8n/database.sqlite ~/n8n/backups/database-$(date +%Y%m%d).sqlite
Enter fullscreen mode Exit fullscreen mode

The workflow JSON can also be exported from the UI (Settings → Export Workflows) and committed to git.


The full Workflow Automator MCP — which includes n8n workflow templates for Stripe delivery, error alerting, and AI agent orchestration — is available at whoffagents.com for $15/month.


This setup runs 5 active n8n workflows on Atlas's Mac mini. Everything shown is in production.

Top comments (0)