Skip to content

@tank/macos-maintenance

1.0.0

macOS health checks, security audit, and maintenance. Diagnoses disk SMART, battery, memory pressure, security (SIP, Gatekeeper, FileVault, firewall), updates, Time Machine, network, launch daemons. Scored checkup script. Triggers: mac health check, system checkup, is my mac ok, mac maintenance, mac running slow, battery health, SMART status, memory pressure, security audit, firewall status, periodic maintenance, flush DNS, rebuild spotlight, Wi-Fi issues, mac slow, fan loud.


name: "@tank/macos-maintenance" description: | macOS system health checks, security auditing, and periodic maintenance. Diagnoses disk SMART status, battery health, memory pressure, CPU thermals, security posture (SIP, Gatekeeper, FileVault, firewall, XProtect), pending updates, Time Machine backups, network issues, launch daemon cruft, and macOS periodic maintenance scripts. Includes a system checkup script that produces a scored health report. Companion to @tank/macos-cleanup (space recovery) — this skill focuses on system health, not disk space.

Trigger phrases: "mac health check", "system checkup", "is my mac ok", "mac maintenance", "system maintenance", "mac running slow", "check SIP", "check FileVault", "check Gatekeeper", "battery health", "battery cycle", "SMART status", "disk health", "memory pressure", "mac security audit", "firewall status", "mac diagnostics", "periodic maintenance", "flush DNS", "rebuild spotlight", "rebuild launch services", "login items", "startup items", "launch agents", "launch daemons", "Wi-Fi issues", "network diagnostics", "mac updates", "brew outdated", "softwareupdate", "Time Machine status", "mac slow", "fan loud", "mac hot", "system check", "OnyX", "mac tune up", "kernel extensions", "system extensions", "mac security check"

macOS Maintenance

System health checks, security auditing, and periodic maintenance for macOS. Keeps your Mac healthy, secure, and performant — the diagnostic counterpart to @tank/macos-cleanup (which handles disk space recovery).

Core Philosophy

  1. Diagnose before fixing. Run the checkup script first. Understand the state of the system before changing anything.
  2. Scored health reports. Every check is PASS/WARN/FAIL. Users see a clear scorecard, not a wall of terminal output.
  3. Security by default. SIP, Gatekeeper, FileVault, and firewall should all be enabled. Flag anything that's off.
  4. Non-destructive. Diagnostics are read-only. Maintenance actions (flush DNS, rebuild Spotlight, run periodic scripts) are safe and idempotent — running them extra times causes no harm.
  5. Know when to restart. Many issues resolve with a restart. Check uptime and recommend restart when >30 days.

Quick-Start

"Is my Mac OK?" / "Run a health check"

bash scripts/system-checkup.sh

The script checks security, disk, battery, memory, uptime, updates, maintenance scripts, and Time Machine. Outputs a scored report.

Flags:

  • --json — machine-readable output
  • --quick — skip slow checks (software updates)
  • --security-only — only run security posture checks

"My Mac is running slow"

StepCheckCommand
1Memory pressurememory_pressure
2CPU hogsps aux --sort=-%cpu | head -11
3Disk spacedf -h / (needs >10% free)
4Swap usagesysctl vm.swapusage
5Uptimeuptime (restart if >30 days)
6Spotlight indexingmdutil -s /
7RestartFixes most transient issues

"Run security audit"

bash scripts/system-checkup.sh --security-only

Or the agent can check manually — see references/security-posture.md for the full scorecard.

"Run periodic maintenance"

sudo periodic daily weekly monthly

Safe and idempotent. Rotates logs, rebuilds system databases. Should be done if the Mac sleeps through scheduled run times (common for laptops).

Decision Trees

What to Check Based on Symptom

SymptomFirst CheckThen
Mac is slowMemory + CPUDisk space, uptime, Spotlight
Fan is loudCPU usageThermal state, runaway processes
Battery drains fastpmset -g assertionsActivity Monitor Energy, cycle count
Wi-Fi issuesSignal strength (RSSI)DNS, DHCP renewal
Apps crashDisk space, memoryCrash logs in DiagnosticReports
Can't install updatesDisk space (need ~15 GB)SIP status, time/date
Search brokenSpotlight index statusRebuild: sudo mdutil -E /
Wrong app opens filesLaunch Services DBRebuild: lsregister -kill -r ...
Login is slowLogin items countLaunch agent audit

Security Issue Priority

IssueSeverityAction
SIP disabledCriticalRe-enable from Recovery Mode
FileVault offHighEnable in System Settings
Gatekeeper offHighsudo spctl --master-enable
Firewall offMediumEnable via socketfilterfw
Auto-updates offMediumEnable in System Settings
Remote Login onLowDisable if not needed

Maintenance Frequency

TaskFrequencyWhen
macOS updatesWeeklysoftwareupdate -l
Homebrew updateWeeklybrew update && brew upgrade
Periodic scriptsAuto (or force monthly)sudo periodic daily weekly monthly
Security auditQuarterlysystem-checkup.sh --security-only
Full health checkQuarterlysystem-checkup.sh
SMART disk checkQuarterlydiskutil info disk0 | grep SMART
Battery checkMonthly (laptops)system_profiler SPPowerDataType
Login items auditQuarterlyReview ~/Library/LaunchAgents/
Flush DNSAs neededAfter VPN/DNS issues
Rebuild SpotlightAs neededWhen search is broken

Common Fix Commands

# Flush DNS
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder

# Rebuild Launch Services (fixes "Open With" duplicates)
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder

# Rebuild Spotlight
sudo mdutil -E /

# Force periodic maintenance
sudo periodic daily weekly monthly

# Renew DHCP lease
sudo ipconfig set en0 DHCP

# Enable firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on

# Check for macOS updates
softwareupdate -l

Reference Files

FileContents
references/health-checks.mdDisk SMART, battery cycle/condition, memory pressure/swap, CPU/thermal, uptime, Time Machine, Spotlight — with commands, thresholds, and fix procedures
references/security-posture.mdSIP, Gatekeeper, FileVault, firewall, XProtect/MRT, remote access, auto-updates, login items audit, privacy settings — with full security scorecard
references/maintenance-tasks.mdPeriodic scripts, DNS flush, Launch Services rebuild, Spotlight rebuild, NVRAM/SMC reset, launch daemon audit, app updates, maintenance schedule, troubleshooting guides
references/network-diagnostics.mdConnectivity tests, DNS diagnostics, Wi-Fi signal/channel analysis, port testing, VPN status, proxy settings, network performance, network reset procedure

Scripts

ScriptUsage
scripts/system-checkup.shFull system health report with scored results. Flags: --json, --quick, --security-only

Command Palette

Search skills, docs, and navigate Tank