defaults write on Mac: Change Hidden Settings Safely
Almost every checkbox in System Settings — plus hundreds of switches Apple never exposed — is stored as a key in a preference file. The defaults command reads and writes those keys directly, which makes it the standard tool for changing hidden Mac settings. Used carelessly, it can also scramble an app's preferences, so the habits below matter as much as the syntax.
How defaults actually works
Every app and system component keeps its preferences in a property list (plist), most of them under ~/Library/Preferences. Each plist belongs to a domain that usually looks like a reverse web address: com.apple.finder for Finder, com.apple.dock for the Dock. The defaults command doesn't edit those files by hand — it talks to the macOS preference system, so changes go through the system's cache correctly and take hold the next time the app reads them. That is exactly why defaults is safer than opening plist files in a text editor.
To see which domains exist on your Mac, or dump everything one domain contains:
# list every preference domain, one per line
defaults domains | tr ',' '\n'
# dump every key the Dock currently stores
defaults read com.apple.dock
Read before you write
Before changing any key, read it and note what comes back. That one habit makes every tweak reversible.
# check a single key
defaults read com.apple.dock tilesize
You'll get one of two results: a value (write it down), or an error saying the pair does not exist. The error is normal — it means the app is using its built-in default, and to undo your change later you'll simply delete the key rather than restore a value.
Write syntax and data types
The pattern is always defaults write domain key -type value. The type flag matters: if you omit it, the value is stored as a string, and an app expecting a boolean or integer may ignore it. The four you'll use constantly are -bool, -int, -float, and -string.
# boolean: show hidden files in Finder
defaults write com.apple.finder AppleShowAllFiles -bool true
killall Finder
# undo: remove the key, restoring Finder's default
defaults delete com.apple.finder AppleShowAllFiles
killall Finder
# float: remove the Dock's auto-hide delay
defaults write com.apple.dock autohide-delay -float 0
killall Dock
# undo
defaults delete com.apple.dock autohide-delay
killall Dock
Both examples work identically on macOS 13 Ventura, 14 Sonoma, and 15 Sequoia. defaults delete domain key is the universal undo: it removes your override so the app falls back to its factory behavior. Be careful never to run defaults delete domain without a key — that wipes every preference the app has.
Make the change take effect — and stay safe
Apps read their preferences at launch, so most changes only appear after a restart of the affected process. For regular apps, quit and reopen them. For system components, restart them with killall — Finder, the Dock, and friends respawn automatically within a second or two.
# apply changes to Finder or the Dock
killall Finder
killall Dock
Three habits keep defaults safe. First, only use keys documented by a source you trust — an invented key does nothing, and a mistyped one just clutters the plist, but a wrong value on a real key can misbehave. Second, read and record the current value before writing. Third, change one thing at a time, so if something feels off you know exactly which key to delete. Nothing defaults writes to your user domains requires sudo; if a guide tells you to sudo a user preference, skip it.
Mainspring packages 90+ of these hidden defaults into labelled, reversible toggles — each one shows exactly what it changes, applies it instantly, and flips back with one click. No syntax, no typos, no forgotten undo commands.
Try Mainspring free →Signed & notarized by Apple · 1-day free trial · $29 once
When something goes wrong
If a tweak didn't do what you expected, the fix is one command: delete the key and restart the app. The full routine — including what to do when you had a custom value before — is in our guide to undoing a defaults write command.