Skip to content
Menu

Mac Health and Security Summary

Reads a Mac's OS version, SIP, Gatekeeper, FileVault, firewall, XProtect, MDM enrollment, uptime, disk space and battery into one table and one line for a custom field.

Mac health and security summary is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review Mac health and security summary. Tell other MSPs how it worked for you.

Write a Review

LanguageBash
Runs onmacOS 13+; runs as root
Needsbash 3.2, root recommended
Read-onlyReads, changes nothing

What It Does

The script collects the facts in one run and puts them in one table: the macOS version and build, the model and chip, System Integrity Protection, Gatekeeper, FileVault, the application firewall and stealth mode, the XProtect data version, uptime, free space on the data volume (or root if it cannot read the data volume) and MDM enrollment. When it detects an internal battery, it shows cycle count and condition, and maximum capacity if reported.

Checking for software updates contacts Apple and can take a minute or two, so CHECK_UPDATES is false by default. When you turn it on, the check is stopped after UPDATE_TIMEOUT_SECONDS and the row says it timed out.

Run it as root for the best coverage. An unreadable check can still say Unavailable or unknown. It never alerts and changes nothing, and the one-line answer is made for a custom field.

Before You Run It

  • Run it as root, or some rows say Unavailable. It warns you when it is not root.
  • Leave CHECK_UPDATES off for a quick run. Turn it on only when the Mac has internet and you can wait.
  • Use RESULT_FIELD to write the one-line answer to an RMM custom field and read the fleet from there.
  • A Mac that is not enrolled in MDM says so. That is a fact to read, not a fault in the script.

Type and Risk

  • Type: Report. It collects facts into a table and never alerts. It exits 0, or 2 when it could not run.
  • Risk: Low. It reads and changes nothing.
  • Restart: It never restarts the machine.
  • Typical run: Under 15 seconds (up to the timeout when CHECK_UPDATES is true).
  • Example answer: "macOS 15.1 (24B83); SIP on; Gatekeeper on; FileVault on; firewall on; MDM yes; up 6d; 212 GB free"
  • Tested before listing on macOS 27 (Apple silicon VM) with /bin/bash 3.2, run as root, against its own test cases.

Inputs

Pass an input as an argument (--input-name value), as an environment variable named as listed, which is how most RMMs pass script variables, or change its default in the DEFAULT_ lines near the top of the script. An argument wins over an environment variable, which wins over the default.

  • CHECK_UPDATES: Count pending software updates (slow, needs internet). Default false.
  • UPDATE_TIMEOUT_SECONDS: Stop the update check after N seconds. 10-1800. Default 120.

Every script also takes DRY_RUN, OUTPUT_FORMAT (Text, Answer, Json or Csv), EXPORT_PATH and RESULT_FIELD, which writes the answer to an RMM custom field, unless the list above words one differently.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

get-mac-health-summary.sh · 680 lines · 29.2 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.