Plists - Property Lists

Property List (.plist) files are a common configuration format in macOS. A plist is essentially a structured data file (XML or binary) that represents a hierarchy of key-value pairs (objects) which macOS can store and read later. In other words, plists provide a portable way to persist small amounts of structured data (dictionaries, arrays, strings, etc.) to disk for later use by applications or system services. Many macOS settings and app configurations are stored as plists; for example, an app’s Info.plist or various preference files.

TODO GET IMAGE

In the context of system startup and persistence, plists serve as the configuration files for launchd jobs (Launch Agents and Launch Daemons). These plist files describe how and when a background service or script should be started by macOS. Each launchd job has an associated plist that defines properties such as: what program or script to execute, any arguments, when to run it (e.g. at load or on a schedule), and under what conditions to keep it running. Launchd reads these plist files during system boot or user login to determine which services to launch. Essentially, the plist “tells” launchd about a daemon or agent and how to manage it.

Characteristics of macOS plists:

  • Format: XML by default (human-readable), with an Apple-defined schema of <dict>, <array>, <string>, etc., or optionally a more compact binary format. (JSON plists are possible in some cases, but XML is most common.)
  • Use in Launchd: The launchd plists contain keys like Label (a unique job name), Program or ProgramArguments (the executable path and args), RunAtLoad (a boolean indicating if it should run immediately at load/login), KeepAlive (whether to restart if it exits), and others. These keys inform launchd’s behavior for that job. (Apple provides a full list of possible keys in the launchd.plist man page.)
  • Locations: Plist files can reside in various Library directories depending on their purpose (detailed below). For launchd jobs, the location of the plist determines whether it’s treated as a system Launch Daemon, a global Launch Agent, or a user Launch Agent.

Plists are the configuration backbone for many macOS components. In terms of startup items, a plist file is what defines a Launch Agent or Daemon’s behavior. They are a mechanism by which macOS persistently schedule programs to run.