Scripting MacOS Configuration
Tips for scripting your mac setup.
Recently, I deleted my hard drive and re-installed MacOS. Before I did that, I spent a lot of time building out some scripts to make sure I had everything backed up and that I could get everything set up quickly.
But what about things that are not on that script? How do you figure out what
defaults keys to edit?
Here is how I went about it...
defaultsvalues and save them to a file.1defaults read > before.json
Make a change. For example, I went into System Preferences -> Mouse -> enabled Secondary click
defaultsagain and save them to a different file.1defaults read > after.json
Use your favorite diff tool to compare
after.jsonto see what has changed.
This should help you figure what your command is to edit. For my example above, I added the following to my setup script:
1# Mouse: enable right-click2defaults write com.apple.AppleMultitouchMouse MouseButtonMode TwoButton