$ ./mactechbuds.sh
Starting MacTechBuds...
Blog engine loaded ✓
AI tools ready ✓
Bash scripts active ✓
Timer system ready ✓
Theme engine active ✓
Dev tools online ✓
mactechbuds.com >
Back to Tech Thoughts

Shell Scripts for macOS Administration

Overview

A collection of Bash and Zsh scripts for macOS system administration, device management, and automation tasks. All scripts are tested on macOS Sonoma and Sequoia.

Scripts Available

System Health Check

Runs a comprehensive system health audit: disk usage, RAM pressure, Gatekeeper status, SIP status, and last software update date. Outputs a human-readable report.

bash
#!/bin/bash
echo "=== macOS System Health ==="
echo "OS Version: $(sw_vers -productVersion)"
echo "Disk Usage:"
df -h /
echo "SIP Status: $(csrutil status)"
echo "Gatekeeper: $(spctl --status)"

Logout & Cleanup

Deletes Safari cache, empties Trash, resets Launchpad database, and clears system logs. Safe for use as a Jamf policy script triggered on logout.

User Account Audit

Lists all local user accounts, their UID, home directory, shell, and whether they have a SecureToken. Outputs as tab-separated CSV for easy reporting.

MDM Enrollment Check

Verifies that a Mac is enrolled in MDM, checks APNS certificate validity, and confirms the management profile is installed. Exits with code 0 (pass) or 1 (fail) for Jamf policy use.

All scripts are available in the Apple_Mac repository.