Pick the protections you want in your script.
Profiles blend severity and compatibility. Relaxed focuses on safer changes that rarely break modern Macs. Strict adds opinionated crypto tightening and remote access restrictions that can affect legacy workflows. Custom lets you hand-pick every item. There are no low-severity items in this set.
Relaxed applies critical items plus medium controls that are unlikely to clash with everyday apps. Strict layers on stronger SSH and file sharing changes that can impact older workflows. Use Custom when you want full control over each STIG item.
Caveats: Several controls above are designed to be enforced via configuration profiles or MDM. This script focuses on checks and safe local changes where possible and leaves profile deployment to your management stack. Some items, such as SMB, SSH, and web server changes, can break existing workflows. Always compare the output with the official DISA macOS STIG for your version before widespread rollout.
How to use: Save the script, open Terminal, and run
sudo bash ./macos-baseline.sh apply
to record a pre-change snapshot and apply your selected controls.
To run the rollback block, use
sudo bash ./macos-baseline.sh rollback.
If you prefer to run it as a direct executable, first run
chmod +x macos-baseline.sh.
Reporting: Each apply run writes a small JSON file that records the hostname, OS version, timestamp, profile label, and the list of selected controls before and after changes. Use this alongside your own images, Time Machine, or MDM baselines for recovery planning.
Before you run the script
- Use this only on Macs you own or are explicitly allowed to manage.
- Create a backup, snapshot, or test clone before applying changes.
- Generate the script and skim every section, especially Strict profile items.
- Comment out any blocks that conflict with your MDM, profiles, or apps.
- Test in a lab or non-critical environment before rolling out to a fleet.
Good next steps
- Port any settings you like into configuration profiles or MDM policies.
- Document which STIG controls you mapped and where enforcement truly lives.
- Revisit this baseline as macOS versions, hardware, and risk profiles change.
- Coordinate with security or IT leads before enforcing on shared or corporate devices.