macOS
NextDNS Blocker has excellent support for macOS, using launchd for scheduling.
Installation
Section titled “Installation”Homebrew (Recommended)
Section titled “Homebrew (Recommended)”# Add tapbrew tap aristeoibarra/tap
# Installbrew install nextdns-blocker
# Verifynextdns-blocker --versionpip3 install nextdns-blockerpipx (Isolated)
Section titled “pipx (Isolated)”pipx install nextdns-blocker# Initialize configurationnextdns-blocker init
# Configure domainsnextdns-blocker config edit
# Install watchdognextdns-blocker watchdog installlaunchd Integration
Section titled “launchd Integration”How It Works
Section titled “How It Works”NextDNS Blocker creates launchd jobs for automatic syncing:
| Job | Purpose | Interval |
|---|---|---|
com.nextdns-blocker.sync | Run sync | Every 2 minutes |
com.nextdns-blocker.watchdog | Self-heal | Every 5 minutes |
Job Location
Section titled “Job Location”~/Library/LaunchAgents/├── com.nextdns-blocker.sync.plist└── com.nextdns-blocker.watchdog.plistManaging Jobs
Section titled “Managing Jobs”# Check statusnextdns-blocker watchdog status
# View loaded jobslaunchctl list | grep nextdns
# Unload job manuallylaunchctl unload ~/Library/LaunchAgents/com.nextdns-blocker.sync.plist
# Load job manuallylaunchctl load ~/Library/LaunchAgents/com.nextdns-blocker.sync.plistJob Contents
Section titled “Job Contents”Example plist:
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "..."><plist version="1.0"><dict> <key>Label</key> <string>com.nextdns-blocker.sync</string> <key>ProgramArguments</key> <array> <string>/opt/homebrew/bin/nextdns-blocker</string> <string>sync</string> </array> <key>StartInterval</key> <integer>120</integer> <key>RunAtLoad</key> <true/> <key>StandardOutPath</key> <string>~/.local/share/nextdns-blocker/logs/cron.log</string> <key>StandardErrorPath</key> <string>~/.local/share/nextdns-blocker/logs/cron.log</string></dict></plist>File Locations
Section titled “File Locations”| Component | Path |
|---|---|
| Config | ~/.config/nextdns-blocker/config.json |
| Environment | ~/.config/nextdns-blocker/.env |
| Logs | ~/.local/share/nextdns-blocker/logs/ |
| State | ~/.local/share/nextdns-blocker/ |
| launchd jobs | ~/Library/LaunchAgents/ |
Timezone Detection
Section titled “Timezone Detection”macOS timezone is detected from:
# System timezone linkreadlink /etc/localtimeTo verify:
nextdns-blocker config show | grep timezoneHomebrew Updates
Section titled “Homebrew Updates”# Update formulabrew update
# Upgrade packagebrew upgrade nextdns-blocker
# After upgrade, reinstall watchdog if needednextdns-blocker watchdog installPermissions
Section titled “Permissions”Full Disk Access
Section titled “Full Disk Access”Some operations may require Full Disk Access:
- Open System Preferences → Security & Privacy
- Go to Privacy tab
- Select Full Disk Access
- Add Terminal (or your terminal app)
Gatekeeper
Section titled “Gatekeeper”If blocked by Gatekeeper:
- Open System Preferences → Security & Privacy
- Click Open Anyway if prompted
DNS Cache
Section titled “DNS Cache”Flush DNS cache after blocking changes:
sudo dscacheutil -flushcachesudo killall -HUP mDNSResponderTroubleshooting
Section titled “Troubleshooting”launchd Jobs Not Running
Section titled “launchd Jobs Not Running”# Check if loadedlaunchctl list | grep nextdns
# Check for errorscat ~/Library/LaunchAgents/com.nextdns-blocker.sync.plist
# Check logstail -50 ~/.local/share/nextdns-blocker/logs/cron.logCommand Not Found
Section titled “Command Not Found”# Check PATHecho $PATH
# Common Homebrew paths# Apple Silicon: /opt/homebrew/bin# Intel: /usr/local/bin
# Add to PATH if needed (in ~/.zshrc)export PATH="/opt/homebrew/bin:$PATH"Permissions Errors
Section titled “Permissions Errors”# Fix config permissionschmod 600 ~/.config/nextdns-blocker/.envchmod 600 ~/.config/nextdns-blocker/config.jsonJobs Disappearing
Section titled “Jobs Disappearing”If launchd jobs keep disappearing:
- Check for cleanup tools (CleanMyMac, etc.)
- Add exclusion for
com.nextdns-blocker.* - The watchdog job should auto-restore sync job
Python Not Found
Section titled “Python Not Found”# Check Python versionpython3 --version
# If using Homebrew Pythonbrew install python@3.11
# Link if neededbrew link python@3.11Apple Silicon Notes
Section titled “Apple Silicon Notes”Homebrew Path
Section titled “Homebrew Path”Apple Silicon Macs use /opt/homebrew/bin:
# Check pathwhich nextdns-blockerRosetta Not Required
Section titled “Rosetta Not Required”NextDNS Blocker is pure Python and runs natively on Apple Silicon.
Uninstalling
Section titled “Uninstalling”# Remove watchdog jobsnextdns-blocker watchdog uninstall
# Remove via Homebrewbrew uninstall nextdns-blocker
# Remove configuration (optional)rm -rf ~/.config/nextdns-blocker
# Remove data (optional)rm -rf ~/.local/share/nextdns-blocker