Read, write, and delete macOS user preferences using the defaults command-line tool

domain: developer.apple.com · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Read a preference value: defaults read com.apple.finder ShowPathbar
  2. Write a boolean preference: defaults write com.apple.finder ShowPathbar -bool true
  3. Write an integer: defaults write com.example.myapp LaunchCount -int 5
  4. Delete a specific key: defaults delete com.example.myapp LaunchCount
  5. Read all keys for a domain: defaults read com.example.myapp — output is a plist dictionary.

Known gotchas

Related routes

Automate reading and writing a macOS application's preferences from the command line with the defaults command
support.apple.com · 6 steps · unrated
script macOS preference domain reads/writes with defaults(1) and force cfprefsd to reload its in-memory cache
developer.apple.com · 5 steps · unrated
Run macOS Shortcuts by name from the command line and pass file input/output using the shortcuts CLI
support.apple.com · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans