Benjamin Sago / ogham / cairnrefinery / etc…

Technical notes Maintain macOS app preferences with Specsheet

Well-behaved Mac applications store their settings in the standard OS preferences database, which is sometimes called the “defaults database” after the defaults command to access it.

While some people will provision their Mac systems by repeatedly running defaults write to set their applications up the way they like them, I prefer to make the changes myself, and use Specsheet to check that the changes are in line with what I expect.

Here are two modifications I make to the system:

spec/system.toml
# Use ISO-8601 calendar
[[defaults]]
domain = 'Apple Global Domain'
key    = 'AppleLocale'
value  = 'en_GB@calendar=iso8601'

# Disable recent apps
[[defaults]]
domain = 'com.apple.Dock'
key    = 'show-recents'
value  = 0

Here are some things I change in the built-in suite of apps:

spec/system.toml
# Don’t warn when changing extensions
[[defaults]]
domain = 'com.apple.Finder'
key    = 'FXEnableExtensionChangeWarning'
value  = 0

# Disable things which require network lookups
[[defaults]]
domain = 'com.apple.GEO'
key    = 'ClimateShowWeatherConditions'
value  = 0

# Default TextEdit to plain text
[[defaults]]
domain = 'com.apple.TextEdit'
key    = 'RichText'
value  = 0

And because good native third-party apps will use the same database, I can set the behaviour of those in stone, too:

spec/apps.toml
# Show attachments at the top in MailMate
[[defaults]]
domain = 'com.freron.MailMate'
key    = 'MmShowAttachmentsFirst'
value  = 1

# Do nothing when scrolling side-to-side in IINA
[[defaults]]
domain = 'com.colliderli.iina'
key    = 'horizontalScrollAction'
value  = 2

You can almost certainly get away with having a script that just sets these values for you — I’ve seen other people’s Ansible playbooks before that configure computers in this way. The important part (in my opinion) is that you have a record of everything somewhere.