Skip to content

Instantly share code, notes, and snippets.

@jack-arturo
Created August 22, 2025 04:23
Show Gist options
  • Save jack-arturo/6b010a3ed6a3d1e53a8c1216abf92e7f to your computer and use it in GitHub Desktop.
Save jack-arturo/6b010a3ed6a3d1e53a8c1216abf92e7f to your computer and use it in GitHub Desktop.
Complete macOS Setup Guide for Claude Automation Hub

Complete macOS Setup Guide for Claude Automation Hub

Step 1: Install Claude Desktop & Claude Code

# Install Claude Desktop (if not already installed)
# Download from: https://claude.ai/download

# Install Claude Code via Homebrew (when available)
# Note: As of now, check if Claude Code is released
brew install claude-code

# Or download from Anthropic directly
# Check: https://docs.anthropic.com/en/docs/claude-code

Step 2: Set Up MCP Servers

# Clone the automation hub
cd ~/Documents
git clone https://github.com/verygoodplugins/claude-automation-hub.git
cd claude-automation-hub

# Install Node.js if needed (for MCP servers)
brew install node

# Install MCP dependencies
npm install @modelcontextprotocol/server
npm install @modelcontextprotocol/gmail-server
npm install @modelcontextprotocol/calendar-server
# ... other MCP servers as needed

Step 3: Configure Claude Desktop MCP

Create or edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "gmail": {
      "command": "node",
      "args": ["/path/to/mcp-servers/gmail-server/index.js"],
      "env": {
        "GMAIL_CREDENTIALS": "/Users/YOUR_USERNAME/.config/gmail/credentials.json"
      }
    },
    "calendar": {
      "command": "node", 
      "args": ["/path/to/mcp-servers/calendar-server/index.js"],
      "env": {
        "GOOGLE_CALENDAR_CREDENTIALS": "/Users/YOUR_USERNAME/.config/gcal/credentials.json"
      }
    },
    "filesystem": {
      "command": "node",
      "args": ["/path/to/mcp-servers/filesystem-server/index.js"],
      "env": {
        "ALLOWED_DIRECTORIES": "/Users/YOUR_USERNAME/Documents,/Users/YOUR_USERNAME/Desktop"
      }
    }
  }
}

Step 4: Set Up Cron Automation Scripts

Create automation scripts:

# Create automation directory
mkdir -p ~/automation/scripts
cd ~/automation/scripts

# Create morning routine script
cat > morning-routine.sh << 'EOF'
#!/bin/bash

# Set up environment
export PATH="/usr/local/bin:/usr/bin:/bin"
export AUTOMATION_HUB="/Users/$(whoami)/Documents/claude-automation-hub"
export NTFY_TOPIC="your-unique-topic-here"

# Log file
LOG_FILE="/Users/$(whoami)/automation/logs/morning-$(date +%Y%m%d-%H%M%S).log"
mkdir -p "$(dirname "$LOG_FILE")"

# Function to send notification
send_notification() {
    curl -s -X POST "https://ntfy.sh/$NTFY_TOPIC" \
        -H "Title: Claude Automation" \
        -H "Priority: default" \
        -H "Tags: morning,automation" \
        -d "$1" >> "$LOG_FILE" 2>&1
}

# Start notification
send_notification "🔄 Starting morning routine..."

# Execute with Claude Code
if command -v claude-code &> /dev/null; then
    # If Claude Code is installed
    claude-code execute \
        --project "$AUTOMATION_HUB" \
        --prompt "$(cat $AUTOMATION_HUB/workflows/daily/morning-routine.md)" \
        >> "$LOG_FILE" 2>&1
    
    STATUS=$?
else
    # Fallback: Use AppleScript to control Claude Desktop
    osascript << 'APPLESCRIPT'
tell application "Claude"
    activate
    delay 1
    
    -- Create new conversation
    tell application "System Events"
        keystroke "n" using command down
        delay 1
    end tell
    
    -- Read and paste workflow
    set workflowPath to "/Users/YOUR_USERNAME/Documents/claude-automation-hub/workflows/daily/morning-routine.md"
    set workflowContent to read POSIX file workflowPath
    
    set the clipboard to workflowContent
    tell application "System Events"
        keystroke "v" using command down
        delay 1
        key code 36 -- Enter key
    end tell
end tell
APPLESCRIPT
    STATUS=$?
fi

# Send completion notification
if [ $STATUS -eq 0 ]; then
    send_notification "✅ Morning routine completed successfully!"
else
    send_notification "❌ Morning routine failed with status $STATUS"
fi

exit $STATUS
EOF

# Make script executable
chmod +x morning-routine.sh

Step 5: Configure macOS Cron

# Edit crontab
EDITOR=nano crontab -e

# Add cron jobs (use full paths!)
# Morning routine at 8:00 AM
0 8 * * * /Users/YOUR_USERNAME/automation/scripts/morning-routine.sh

# End of day at 6:00 PM
0 18 * * * /Users/YOUR_USERNAME/automation/scripts/end-of-day.sh

# Weekly review on Fridays at 4:00 PM
0 16 * * 5 /Users/YOUR_USERNAME/automation/scripts/weekly-review.sh

Step 6: Handle macOS Permissions

IMPORTANT: macOS requires special permissions for automation:

# 1. Grant Terminal/iTerm cron access
# System Preferences > Security & Privacy > Privacy > Full Disk Access
# Add: /usr/sbin/cron

# 2. Grant accessibility permissions for AppleScript
# System Preferences > Security & Privacy > Privacy > Accessibility
# Add: Terminal (or iTerm)

# 3. Test permissions
/usr/sbin/cron -n

# 4. If using launchd instead of cron (recommended for macOS)
# Create plist file instead

Step 7: Use launchd Instead (macOS Preferred)

Create ~/Library/LaunchAgents/com.claude.morning-routine.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.claude.morning-routine</string>
    
    <key>ProgramArguments</key>
    <array>
        <string>/Users/YOUR_USERNAME/automation/scripts/morning-routine.sh</string>
    </array>
    
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>8</integer>
        <key>Minute</key>
        <integer>0</integer>
    </dict>
    
    <key>StandardOutPath</key>
    <string>/Users/YOUR_USERNAME/automation/logs/morning-routine.log</string>
    
    <key>StandardErrorPath</key>
    <string>/Users/YOUR_USERNAME/automation/logs/morning-routine.error.log</string>
    
    <key>EnvironmentVariables</key>
    <dict>
        <key>PATH</key>
        <string>/usr/local/bin:/usr/bin:/bin</string>
        <key>NTFY_TOPIC</key>
        <string>your-unique-topic-here</string>
    </dict>
</dict>
</plist>

Load the launchd job:

# Load the job
launchctl load ~/Library/LaunchAgents/com.claude.morning-routine.plist

# Verify it's loaded
launchctl list | grep claude

# Start it manually for testing
launchctl start com.claude.morning-routine

# Check logs
tail -f ~/automation/logs/morning-routine.log

Step 8: Set Up Notifications

# Install ntfy on iOS/Android
# iOS: https://apps.apple.com/app/ntfy/id1625396347
# Android: https://play.google.com/store/apps/details?id=io.heckel.ntfy

# Set environment variable
echo 'export NTFY_TOPIC="claude-hub-$(whoami)-$(openssl rand -hex 4)"' >> ~/.zshrc
source ~/.zshrc

# Test notification
curl -d "Test from macOS setup" "https://ntfy.sh/$NTFY_TOPIC"

Step 9: Test Everything

# Test script manually first
./automation/scripts/morning-routine.sh

# Check if cron is running
sudo launchctl list | grep cron

# Monitor cron logs
log show --predicate 'process == "cron"' --last 1h

# Test Claude Code (if installed)
claude-code execute --prompt "List my calendar events for today"

Troubleshooting macOS Issues:

# If cron isn't working, check mail for errors
mail

# If permissions denied
sudo crontab -u $(whoami) -e

# If Claude Desktop automation fails
# Enable Accessibility in System Preferences for Terminal

# If MCP servers aren't connecting
# Restart Claude Desktop after config changes
killall Claude
open -a Claude

# Check MCP server logs
tail -f ~/Library/Logs/Claude/mcp-*.log

Alternative: Quick Test Setup

For immediate testing without full setup:

# Simple test that works right now
cat > test-automation.sh << 'EOF'
#!/bin/bash

# Use AppleScript to paste into Claude Desktop
osascript -e 'tell application "Claude" to activate'
sleep 1

# Type a simple command
osascript -e 'tell application "System Events" to keystroke "What time is it and what should I be doing?"'
osascript -e 'tell application "System Events" to key code 36'
EOF

chmod +x test-automation.sh
./test-automation.sh

The main considerations for macOS:

  1. Use launchd instead of cron (more reliable on macOS)
  2. Full paths required everywhere
  3. Permissions are critical (Full Disk Access, Accessibility)
  4. Claude Code may not be available yet - check Anthropic's site
  5. AppleScript fallback works but is less reliable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment