| name | macos-services |
| description | Manage macOS services and daemons using launchctl, plus system info and maintenance |
| user-invocable | true |
| os | ["darwin"] |
| navig-commands | ["navig run \"launchctl list\"","navig run \"launchctl kickstart system/{service}\"","navig run \"system_profiler SPSoftwareDataType\"","navig run \"top -l 1 -n 0 | head -10\""] |
| examples | ["What services are running on the Mac?","Check macOS system info","Restart a service on macOS","How much memory is the Mac using?","Show Mac system info"] |
macOS Service & System Management
Manage services, check system health, and perform maintenance on macOS machines.
System Info
Quick System Overview
User says: "Show Mac system info"
sw_vers
sysctl -n hw.memsize | awk '{print $0/1073741824 " GB RAM"}'
sysctl -n hw.ncpu
uptime
Response format:
🍎 macOS System Info:
OS: macOS 15.2 Sequoia
Model: MacBook Pro (M3 Pro)
CPU: 12 cores
RAM: 36 GB
Uptime: 5 days, 3 hours
Memory Usage
top -l 1 -n 0 | head -12
Or more readable:
memory_pressure
Disk Space
df -h / | tail -1
Service Management (launchctl)
macOS uses launchd instead of systemd. Services are called "launch agents" (user) and "launch daemons" (system).
List Running Services
launchctl list | head -30
Check Specific Service
launchctl list | grep {service}
Start a Service
sudo launchctl kickstart system/{service}
launchctl kickstart gui/$(id -u)/{service}
Stop a Service
sudo launchctl kill SIGTERM system/{service}
Load/Unload a Service
sudo launchctl load /Library/LaunchDaemons/{service}.plist
sudo launchctl unload /Library/LaunchDaemons/{service}.plist
Homebrew Services (Preferred)
For services installed via Homebrew, prefer brew services (much simpler):
brew services list
brew services start {service}
brew services stop {service}
brew services restart {service}
See the homebrew skill for details.
Common macOS Admin Tasks
Flush DNS Cache
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder
Check Open Ports
lsof -iTCP -sTCP:LISTEN -n -P
Response format:
🌐 Open Ports on Mac:
• :3000 - node (PID: 1234)
• :5432 - postgres (PID: 5678)
• :6379 - redis (PID: 9012)
• :8080 - java (PID: 3456)
Kill Process by Port
lsof -ti:8080 | xargs kill -9
Check Battery Health (Laptops)
system_profiler SPPowerDataType | grep -A5 "Health"
Check Storage Breakdown
du -sh ~/Library/Caches ~/Library/Logs ~/Downloads 2>/dev/null
Empty Trash from Terminal
rm -rf ~/.Trash/*
Rebuild Spotlight Index
sudo mdutil -E /
macOS vs Linux Reference
| Task | Linux | macOS |
|---|
| Service status | systemctl status x | launchctl list | grep x |
| Start service | systemctl start x | launchctl kickstart system/x |
| Stop service | systemctl stop x | launchctl kill SIGTERM system/x |
| Package install | apt install x | brew install x |
| Firewall | ufw | pfctl |
| Process viewer | htop | htop or top -o cpu |
| Open ports | ss -tlnp | lsof -iTCP -sTCP:LISTEN |
Safety Rules
- Safe:
launchctl list, sw_vers, top, df (read-only)
- Confirm:
brew services start/stop, killall, kill
- Double confirm:
launchctl unload, rm -rf, mdutil -E
Error Handling
- Permission denied: "This requires sudo. Try with admin privileges."
- Service not found: "Service '{name}' not found. Check with
launchctl list | grep {name}"
- SIP restriction: "System Integrity Protection prevents this action. Some system services can't be modified."