Skip to content

Instantly share code, notes, and snippets.

@liddiard
Last active April 26, 2026 13:37
Show Gist options
  • Select an option

  • Save liddiard/20bf626a9e834b8b3962cb27b3551633 to your computer and use it in GitHub Desktop.

Select an option

Save liddiard/20bf626a9e834b8b3962cb27b3551633 to your computer and use it in GitHub Desktop.
Back up and restore macOS system and app settings ("defaults"). Note that there are several caveats with this approach, including but not limited to: Not all apps' preferences are managed through `defaults`, App Store-installed apps may not appear here, and some domains may be write-protected.
# Run in a dedicated directory. Lists all settings plist files, converts the
# list to newline-separated, and writes each to a plist file.
defaults domains | tr ',' '\n' | xargs -I '{}' defaults export '{}' '{}'.plist
# Run in the directory containing your plist files from the export.sh script.
# Lists the exported plist files, removes the ".plist" extension, and imports
# each into system/app settings.
ls *.plist | sed 's/\.plist$//' | xargs -I '{}' defaults import '{}' '{}'.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment