launchd.plist

System-wide/per-user daemon/agent configuration files

Parameters given to an XML property list to be loaded into launchd with launchctl.

Found in
/System/Library/LaunchDaemons and /System/Library/LaunchAgents,
/Library/LaunchAgents , /Library/LaunchDaemons, ~/Library/LaunchAgents

A daemon or agent launched by launchd

  • in the process directly launched by launchd MUST NOT
  • as part of their startup initialization SHOULD NOT
  • SHOULD:

    XML PROPERTY LIST KEYS

    Property lists filenames end in .plist

    label, ProgramArguments entries are required.
    Label string uniquely identifies the job to launchd.
    Program stringfirst argument of execvp(program).
    If omitted the first element of the of ProgramArguments array of strings will be used.
    ProgramArguments array of strings second argument to execvp(array of pointers to args).
    Disabled T | F default false. Depreacted see /var/db/
    UserName string user to run the job. default user who submitted the job to launchd.
    GroupName string  
    OnDemand T | F launched on demand (default) or
    kept continuously running
    RunAtLoad T | F launched once when the job is loaded. default false.
    HopefullyStartsSerially T | F
    not used as of leopard
    exit earlier during system shutdown ref
    HopefullyExitsFirst T | F exit earlier during system shutdown ref
    used by: mDNSResponder,
    depricatedSystemStarter starts rc.local and rc.shutdown.local
    HopefullyExitsLast T | F ref
    exit in a second wave during system-shutdown used by:
    mDNSResponderHelper, DirectoryServices, diskarbitrationd, lockd, notifyd, portmapd
    RootDirectory dir chroot dir before running the job.
    WorkingDirectory dir cd dir before running the job.
    ServiceDescription string purpose of the job.
    EnvironmentVariables dictionary of strings set before running the job.
    inetdCompatibility dictionary this daemon expects to be run as if it were launched from inetd.
    This is incompatible with ServiceIPC .
    ServiceIPC T | F if the job participates in advanced communication with launchd. default is false.
    Incompatible with inetdCompatibility .
    ThrottleInterval integer seconds before restarting (zero will be complained about and 10 used)
    TimeOut integer Passed to the job. If no value is specified, a default time out will be supplied by launchd for use by the job at check in time.
    InitGroups T | F have initgroups be called before running the job. The default is false.
    AbandonProcessGroup T | F
    WatchPaths array of strings job started if any one of the listed paths are modified.
    StartOnMount=bool
    QueueDirectories array of strings job started if the path modified is a directory and the directory is not empty.
    StartInterval integer job started every N seconds.
    If the system is asleep, the job will be started the next time the computer wakes up.
    If multiple intervals transpire before the computer is woken, those events will be coalesced into one event upon wake from sleep.
    StartCalendarInterval dictionary of integers job is started every calendar interval .
    Missing arguments are considered to be wildcard, i.e. every.
    The semantics are like crontab.
    Unlike cron which skips job invocations when the computer is asleep,
    launchd will start the job the next time the computer wakes up!
    If multiple intervals transpire before the computer is woken, those events will be coalesced into one event
    Minute integer Hour integer Day integer Weekday integer The weekday on which this job will be run (0 and 7 are Sunday). Month integer
    StandardOutPath string  
    StandardErrorPath string used by alf /var/log/alf.log,
    FileSyncAgent.sshd/dev/null
    pcast agentd /Library/Logs/pcastagentd,
    ssh /dev/null
    Debug T | F launchd should adjust its log mask temporarily to LOG_DEBUG while dealing with this job.
    SoftResourceLimits dictionary of integers

    HardResourceLimits dictionary of integers

    Resource limits to be imposed on the job. These adjust variables set with setrlimit.
    Core integer largest size (in bytes) core file that may be created.
    CPU integer maximum cpu seconds to be used by each process.
    Data integer maximum bytes of the data segment for a process; this defines how far a program may extend its break with the sbrk system call.
    FileSize integer largest size (in bytes) file that may be created.
    MemoryLock integer maximum bytes which a process may lock into memory using mlock .
    NumberOfFiles integer maximum number of open files for this process.
    NumberOfProcesses integer maximum number of simultaneous processes for this user id.
    ResidentSetSize integer maximum bytes to which a process's resident set size may grow. This imposes a limit on the amount of physical memory to be given to a process; if memory is tight, the system will prefer to take memory from processes that are exceeding their declared resident set size.
    Stack integer maximum bytes of the stack segment for a process; this defines how far a program's stack segment may be extended. Stack extension is performed automatically by the system.
    keepalivedictionary of PathStates (?) See /Library/LaunchAgents/com.gog.galaxy.commservice.plist
    PathStatepath boolean
    Nice integer nice value applied to the daemon.
    LowPriorityIO T | F daemon to be low priority when doing file system I/O.
    Wait T | F corresponds to wait or nowait of inetd.
    MachServices dictionary of boolean agents or daemons required
    Sockets dictionary of dictionaries... OR
    dictionary of array of dictionaries...
    on demand sockets that can be used to let launchd know when to run the job.
    The job can check-in and get a copy of the file descriptors using APIs outlined in launch.
    The keys of the top level Sockets dictionary are meant for the application developer to use to differentiate different which descriptors correspond to which application level protocols (e.g. http vs. ftp vs. DNS...).
    At check in time, the value of each Sockets dictionary key will be an array of descriptors. Daemon/Agent authors should consider all descriptors of a given key to be to be effectively equivalent, even though each file descriptor likely represents a different networking protocol which conforms to the criteria specified in the job configuration file.

    used as inputs to call getaddrinfo.
    SockType string stream,dgram or seqpacketdefault stream
    SockPassive T | F if listen should be called on the created file descriptor. default true ("to listen"), otherwise connect .
    SockNodeName string node to connect or bind to.
    SockServiceName string service on the node to connect or bind to.
    SockFamily string IPv4 or IPv6 socket(s) be created.
    SockProtocol string only TCP
    SockPathName string implies SockFamily is set to "Unix". It specifies the path to connect or bind to.
    SockPathMode integer mode of the socket in decimal.

    Bonjour boolean or
            string or
    array of strings
    can be used to request that the service be registered with mDNSResponder.
    If the value is boolean, the service name is inferred from SockServiceName.
    MulticastGroup string used to request that the datagram socket join a multicast group.
    If the value is a hostname, then getaddrinfo will be used to join the correct multicast address for a given socket family.
    If IPv4 or IPv6 address is given, SockFamily is required.
    Umask integer set umask before running the job.

    EXAMPLE XML PROPERTY LISTS

    The following XML Property List simply keeps "exampled" running continuously:
               <?xml version="1.0" encoding="UTF-8"?>
               <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
               http://www.apple.com/DTDs/PropertyList-1.0.dtd >
               <plist version="1.0">
               <dict>
                    <key>Label</key>                    <string>com.example.exampled</string>
                    <key>ProgramArguments</key> <array> <string>exampled</string> </array>
                    <key>OnDemand</key>                 <false/>
               </dict>
               </plist>
    
    

    See also

    Apple developer docs

    see launchctl.1.html

    Also lingoneditor for plists,
    pl converts xml to key=value format

    plistbuddy binary editor