This section will grow as more macOS Intune scripts are added to the toolkit. If you have macOS scripts to contribute, follow the same structure used in the Windows sections — a folder per script with a README and the script file(s).
How macOS scripting in Intune works
MacOS devices managed by Intune use shell scripts (bash or zsh) rather than PowerShell. Scripts are deployed through Intune’s Device Scripts feature, which runs them on enrolled macOS devices.Key differences from Windows PowerShell scripts
| Aspect | Windows (PowerShell) | macOS (Shell) |
|---|---|---|
| Language | PowerShell (.ps1) | Bash / Zsh (.sh) |
| Execution context | SYSTEM or logged-on user | Root or logged-in user |
| Feature used | Device Scripts / Proactive Remediations | Device Scripts |
| Compliance scripts | Custom Compliance (PowerShell) | Not supported for custom compliance |
| Script signing | Optional (configurable) | Not required |
| Re-run behavior | Configurable schedule | Run once, or on each check-in |
macOS Device Scripts in Intune
Device Scripts on macOS run as a one-time or recurring task. They are suitable for:- Installing agents or software
- Applying configuration settings via
defaults writeor configuration profiles - Running post-enrollment setup tasks
- Collecting device information
Deploying a shell script via Intune
Prepare your shell script
Write a standard bash script. The script must exit with
0 for success or a non-zero code to indicate failure. Output written to stdout/stderr is captured in the Intune management extension logs.Example script structure
Upload the script to Intune
In the Intune admin center, navigate to Devices > macOS > Shell scripts > Add.Upload your
.sh file and configure:- Run script as signed-in user — set to
Yesfor user-context tasks,Noto run as root - Hide script notifications on devices — typically set to
Yesfor silent deployment - Script frequency — how often the script runs (once, daily, weekly, etc.)
- Max number of times to retry if script fails — set a retry count for reliability
Assign to device groups
Assign the script policy to your macOS device groups. The Intune management agent (Microsoft Intune Company Portal) will deliver and execute the script on enrolled devices.
macOS compliance in Intune
Unlike Windows, macOS does not currently support Intune Custom Compliance scripts. macOS compliance is enforced through:- Built-in compliance settings — OS version requirements, password policies, encryption (FileVault), Gatekeeper, firewall state
- Configuration profiles — MDM payloads for system preferences, restrictions, and security settings
- Third-party compliance integrations — some security tools (e.g., CrowdStrike, Jamf) can report compliance posture back to Intune via partner compliance APIs
