I have a couple of Macs and I would like to create some kind of script that I can use to:

  1. Easily setup a new Mac after a reinstall
  2. Update settings to consistent values (so if I decide to change some preferences on Mac A, I can run the script on Mac B to get it to match)

I'd be happy if I could use this script to customize:

  • System Preferences
  • Finder Preferences

I would prefer a method where I can use a script or config file to specifically set certain settings I choose to certain values. I don't really want something that will import/export ALL settings indiscriminately.

I also don't want some complicated IT management solution, since this is really just for me.


You should take a look at Mathias Bynens' Dotfiles. Modify it for your needs and delete the settings you don't need. Then you only need to execute the script with the terminal.app via entering sudo /path/to/the/script/./osx on each mac.


I did some more digging and I managed to find a solution that isn't AppleScript-ed UI movements.

You can script most of the settings changes I wanted to make using the defaults command (wiki).

As for figuring out the actual keys/values that correspond to the UI preferences, I've found lists like this to be useful (this one too). I've also used this little script I wrote to suss out the changes made by the UI:

mv ~/new-defaults.txt ~/old-defaults.txt
defaults read > ~/new-defaults.txt
diff old-defaults.txt new-defaults.txt

It'll give you all the changes to the defaults since the last time it was ran. There's likely going to be other changes detected (like window positions), but most of the keys seemed reasonably named. You can then take the changed key and figure out its domain by searching the full file.

There appear to be other mechanisms for storing preferences in Mac OS besides this (e.g. allowing non-App Store apps does not seem to be reflected in the defaults plists), and I still haven't figured those out. The list I liked above uses some other commands, and I'll have to look into those next.


Don't bother creating something from scratch, it has already been solved many times before as it is part of confoguration management which is a big component in IT automation.

What you are looking for is the 'defaults' system as a low-level text based system Mac OS X uses to manage preferences and settings. This has been enhanced by something else from Apple called Managed Client.

To make it even easier, you have the option of using the Server app by Apple from the AppStore to have a nice GUI to go with that.

You can, however, simply use 'defaults' as-is to automate what you want. You'd still need a bit of scripting to read on one Mac and write on another (SSH is handy for that) over a network connection.

Look them both up (defaults and Managed Client) and a whole new world will open up for you :)


Not sure the motivation for wanting to script this “just for you.” When I get a new system, or a clean install, the way I normally get all the settings I want is by letting Migration Assistant transfer them from my old system or it’s backup.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .