Skip to content

CLI Reference

Complete documentation for all macprefs commands and flags.

Checks write access to user Preferences, runs a safe defaults write/delete smoke test, and warns if MDM profiles are present. No permanent changes are made.

Terminal window
macprefs preflight [--config <config>]
FlagDescription
-c, --config <config>Path to config JSON (optional, validates if provided)
--versionShow the version.
-h, --helpShow help information.

Exit codes:

  • 0 — All checks passed
  • 2 — One or more issues detected

Lists all preference domains, or keys within a specific domain.

Terminal window
macprefs list [--domain <domain>] [--format <format>]
FlagDescription
--domain <domain>Show keys within this domain instead of listing domains
--format <format>Output format (table
--versionShow the version.
-h, --helpShow help information.

Shows current values for preferences across all domains by default.

Terminal window
macprefs inspect [--domains <domains>] [--keys <keys>] [--format <format>]
FlagDescription
--domains <domains>Comma-separated domains to inspect
--keys <keys>Comma-separated keys to filter
--format <format>Output format (table
--versionShow the version.
-h, --helpShow help information.

Exports macOS preferences to a JSON configuration file across all domains by default.

Terminal window
macprefs export <output-file> [--domains <domains>] [--baseline] [--no-progress]

Arguments:

  • <output-file> — Output JSON file path (required)
FlagDescription
--domains <domains>Comma-separated domains to include (defaults to all domains)
--baselineCompare against baseline (v1.1)
--no-progressSuppress progress output (for CI/scripting)
--versionShow the version.
-h, --helpShow help information.

Checks that a config file is valid JSON with correct structure.

Terminal window
macprefs validate [--config <config>] [--format <format>]
FlagDescription
-c, --config <config>Path to config JSON
--format <format>Output format (table
--versionShow the version.
-h, --helpShow help information.

Shows what changes would be made without applying them. Read-only operation.

Terminal window
macprefs plan [--config <config>] [--format <format>] [--verbose] [--filter <filter>]
FlagDescription
-c, --config <config>Path to config JSON
--format <format>Output format (table
-v, --verboseShow all changes in detail
--filter <filter>Filter changes: conflicts, additions, all
--versionShow the version.
-h, --helpShow help information.

Exit codes:

  • 0 — No changes needed (in sync)
  • 2 — Changes detected (drift found)

Applies config changes. Creates snapshot before any changes.

Terminal window
macprefs apply [--config <config>] [--yes] [--rollback-on-fail] [--no-rollback-on-fail] [--verbose]
FlagDescription
-c, --config <config>Path to config JSON
--yesAuto-confirm apply (for CI/CD)
--rollback-on-failRollback on failure (default: enabled)
--no-rollback-on-failDisable rollback on failure
--verboseVerbose output
--versionShow the version.
-h, --helpShow help information.

Exit codes:

  • 0 — Changes applied successfully (or no changes needed)
  • 1 — Apply failed

Restores preferences to their state before an apply operation.

Terminal window
macprefs rollback [--run-id <run-id>]
FlagDescription
--run-id <run-id>Specific run ID to rollback (default: most recent)
--versionShow the version.
-h, --helpShow help information.

Show version and system information.

Terminal window
macprefs about
FlagDescription
--versionShow the version.
-h, --helpShow help information.

Documentation auto-synced from macprefs CLI help.