macOS Defaults
Skill0 starsChanged 4 months agoMITView on GitHub
Set up, repair, upgrade, and optimize a Mac's system preferences as reproducible, idempotent `defaults` code. Use to SET UP a declarative, commented `macos.sh` by capturing current prefs (Dock, Finder, keyboard/trackpad, screenshots), REPAIR a setting that won't take (wrong domain/key/type, needs a restart or sudo, OS-rewritten), UPGRADE by applying the script to converge a machine and reconciling after a macOS update, or OPTIMIZE by auditing live values against the script for drift and tightening the declaration. Every setting is proven by re-reading it — writes are never trusted blindly.
In this repository12 other files it gives its agents.
- Brew DoctorSkill
- Credential StoreSkill
- Dev EnvironmentSkill
- DotfilesSkill
- Ghostty ConfigSkill
- Git SetupSkill
- Identity ProfilesSkill
- Neovim ConfigSkill
- Runtime VersionsSkill
- Shell SyncSkill
- SSH ConfigSkill
- Terminal ThemeSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
Don't know a setting's domain/key?
- Very specific: line 52
Verify by re-reading: After defaults write, defaults read <domain> <key> and confirm it equals the intended value.
- Very specific: line 65
Read ~/.config/devenv/config.toml before prompting.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
macOS defaults
Turn a Mac's system settings into idempotent defaults code, so a machine's preferences are
reproducible, reviewable, and drift is visible. The golden rule is verification-first: prove a
setting took by re-reading it — never trust that a defaults write did what you meant.
Route to a workflow
| The user wants to… | Workflow |
| Snapshot current prefs into a declarative script | reference/setup.md |
| Fix a setting that won't stick (wrong key/type, needs restart/sudo) | reference/repair.md |
| Apply the script to a machine + restart apps; reconcile after an OS update | reference/upgrade.md |
| Find drift between live values and the script, and tighten it | reference/optimize.md |
| Prove settings took (and stay idempotent) | reference/verification.md |
The scripts (call these, don't re-derive them)
The mechanical commands live in scripts/ as tested helpers — call them by
name instead of hand-writing defaults read loops or a parse-and-compare each session:
| Script | Does | Read-only? |
scripts/defaults_read.py [groups… | <domain> <key>] | Read prefs as greppable domain key = value; no args = the curated set; --find/--domains for discovery; missing key → (not set). | yes |
scripts/drift_audit.py <macos.sh> [--quiet] | Parse a declared script's defaults write lines and re-read each live → MATCH/DRIFT/MISSING (type-aware: -bool true == 1; $HOME/~ expanded). | yes |
scripts/defaults_apply.py <macos.sh> [--yes] | Back up → run the script → killall affected apps → flag reboot-needed. Mutating; dry-runs without --yes and confirms before writing. | no |
See scripts/README.md for the full toolbox, a worked example, and conventions.
Discovery (always run first)
sw_vers # macOS version (some keys are version-specific)
ls ~/.config/devenv/macos.sh 2>/dev/null # is there already a declared script?
scripts/defaults_read.py # sample live values across the curated set
scripts/defaults_read.py --find <term> # locate a setting's domain/key by keyword- A domain is an app's pref bundle id (
com.apple.dock,com.apple.finder,NSGlobalDomainfor system-wide). A key is one setting inside it.defaults read <domain> <key>prints one value. - Don't know a setting's domain/key?
scripts/defaults_read.py --find <term>, or diffdefaults readbefore/after toggling it in System Settings — see reference/verification.md.
Core principles
- Verify by re-reading. After
defaults write,defaults read <domain> <key>and confirm it equals the intended value. A silent write can no-op or coerce the type. - Read reality before you declare it.
setupreads current values so the script reflects the machine, not a guess. - Idempotent by construction. The script is pure
defaults writelines — re-running is a no-op.optimizeconfirms live == declared; a secondupgrade(apply) changes nothing. - Some settings need a restart.
killall Dock Finder SystemUIServerpicks up most; a few need logout/reboot and won't reflect until then. Flag those explicitly. - Track the script. It's a dotfile — version it via the
dotfilesskill (chezmoi) so prefs are reproducible across machines.
Settings
Read ~/.config/devenv/config.toml before prompting; if a [macos-defaults] section exists, use it
as defaults (precedence: explicit answer this session > config.toml > ask). Had to ask? Offer to
save the answer back. Managed by the devenv skill. Keys honored:
script— path to the declarative defaults script (e.g.~/.config/devenv/macos.sh).
Safety
- Some domains need
sudo(system-wide/Libraryprefs, login window). Confirm first; never runsudo defaults writewithout the user's go-ahead. - Back up prior values with
defaults read <domain> <key>before writing, so a change is reversible. - Do NOT touch security/privacy settings — FileVault, Gatekeeper, the firewall, TCC — without explicit confirmation. Never disable a security feature silently.
- Some settings require logout or restart to take effect; say so rather than claiming success.
defaults writeis mutating and is deliberately not pre-approved here — the skill reads freely but asks before it writes.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

