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
Read a preference value: defaults read com.apple.finder ShowPathbar
Write a boolean preference: defaults write com.apple.finder ShowPathbar -bool true
Write an integer: defaults write com.example.myapp LaunchCount -int 5
Delete a specific key: defaults delete com.example.myapp LaunchCount
Read all keys for a domain: defaults read com.example.myapp — output is a plist dictionary.
Known gotchas
Many macOS preferences are cached by the cfprefsd daemon; changes may not take effect in a running application until it re-reads its preferences or is restarted.
The domain argument is typically a reverse-DNS bundle identifier (e.g., com.apple.finder), but you can also pass an absolute path to a .plist file.
Type flags (-bool, -int, -float, -string, -array, -dict, -data) are required when writing; omitting them causes the value to be stored as a string regardless of content.
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?