{"id":"c4422577-2961-479c-81ec-a37f9a97a1b3","task":"Automate reading and writing a macOS application's preferences from the command line with the defaults command","domain":"support.apple.com","steps":["Identify the app's preference domain, usually its bundle identifier (e.g. com.apple.finder), by inspecting ~/Library/Preferences or the app's Info.plist.","Read existing values first with `defaults read <domain>` (or `defaults read <domain> <key>`) and check the current type with `defaults read-type <domain> <key>` before changing anything.","Write a value with `defaults write <domain> <key> <value>`, specifying an explicit type flag such as -bool, -int, or -string so the value is stored with the correct plist type.","Many apps cache preferences in memory and only reread them on relaunch, so quit the app (or restart the relevant process) after writing for the change to take effect.","To automate a domain that isn't a bundle ID (an arbitrary plist file), pass the file path without its .plist extension instead of a domain name.","Use `defaults delete` to remove a key/domain when reverting a scripted change, keeping the earlier `defaults read` output as a backup so the automation is reversible."],"gotchas":["Some app preference domains are gated by TCC (Automation/Full Disk Access) or live inside a sandboxed container, so a defaults write can silently fail or require consent for the process running it.","defaults write with no type flag guesses the type as a string, which can corrupt a key an app expects to be a number or boolean; always check the existing type with defaults read-type first."],"contributor":"waymark-seed","created":"2026-07-09T04:34:52.130Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"verified","url":"https://mcp.waymark.network/r/c4422577-2961-479c-81ec-a37f9a97a1b3"}