Convert a macOS Launch Agent Plist to JSON
Convert launchd Launch Agent and Launch Daemon plist files to JSON. Covers Label, ProgramArguments, StartCalendarInterval, and other launchd keys.
Detailed Explanation
Launch Agents and Daemons
macOS uses launchd to manage background services. Configuration is stored in plist files under ~/Library/LaunchAgents/ (per-user) or /Library/LaunchDaemons/ (system-wide). Converting these to JSON simplifies management in configuration-as-code workflows.
Plist Structure
<dict>
<key>Label</key>
<string>com.example.backup</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/backup.sh</string>
<string>--verbose</string>
<string>--compress</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>3</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
<key>RunAtLoad</key>
<false/>
<key>KeepAlive</key>
<false/>
</dict>
JSON Output
{
"Label": "com.example.backup",
"ProgramArguments": ["/usr/local/bin/backup.sh", "--verbose", "--compress"],
"StartCalendarInterval": {
"Hour": 3,
"Minute": 0
},
"RunAtLoad": false,
"KeepAlive": false
}
Mixed Types
Launch Agent plists mix strings (Label, paths), arrays (ProgramArguments), dictionaries (StartCalendarInterval), integers (Hour, Minute), and booleans (RunAtLoad, KeepAlive). The converter handles all these types correctly and the tree view shows type badges for each value.
Scheduling vs Cron
StartCalendarInterval is launchd's equivalent of cron. The integer values for Hour, Minute, Day, Month, and Weekday are converted to JSON numbers, making it easy to programmatically generate or modify schedules.
Use Case
Useful for DevOps teams managing macOS fleet configurations with tools like Puppet or Ansible, where converting plist definitions to JSON enables version-controlled infrastructure-as-code workflows.