Manipulate nested plist structures (arrays and dictionaries) from shell scripts using PlistBuddy

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. PlistBuddy lives at /usr/libexec/PlistBuddy; run commands with the -c flag: /usr/libexec/PlistBuddy -c 'Print' /path/to/file.plist
  2. Read a nested key using colon-delimited paths: /usr/libexec/PlistBuddy -c 'Print :MyDict:MyKey' file.plist
  3. Add a new string value: /usr/libexec/PlistBuddy -c 'Add :NewKey string "hello"' file.plist
  4. Append an item to an array using the colon-suffix notation: /usr/libexec/PlistBuddy -c 'Add :MyArray: string "newitem"' file.plist
  5. Chain multiple -c flags in one invocation for atomic multi-key edits: /usr/libexec/PlistBuddy -c 'Set :Version 2' -c 'Set :BuildDate "2026-06-12"' file.plist

Known gotchas

Related routes

write portable shell automation that accounts for zsh vs bash differences in array indexing and word splitting
zsh.sourceforge.io · 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