All tools Developer

Launchd Plist Generator

Build a macOS launchd .plist from a form, with the launchctl commands to install it.

Install it
  1. launchctl load ~/Library/LaunchAgents/com.example.myjob.plist
  2. launchctl unload ~/Library/LaunchAgents/com.example.myjob.plist

Runs in your browser. Nothing you open or type here is uploaded.

How to use

  1. Enter a label for the job and the path of the program to run.
  2. Choose a schedule: a fixed interval in seconds, a calendar time, or run at login.
  3. Set the working directory, environment variables and log paths if the job needs them.
  4. Copy the generated .plist, or download it, then install it with the launchctl commands shown below.

Details

launchd is the scheduler built into macOS. A job is described by a .plist file, an XML property list, that names the program, its arguments and when it should run: every N seconds (StartInterval), at calendar times (StartCalendarInterval), or once at login. This tool builds that file from a form and shows the launchctl commands to load and unload it. Unlike cron, launchd can wake a sleeping Mac for calendar jobs, can relaunch a job that exits (KeepAlive), and is the mechanism Apple's own tooling expects.

  • For jobs that run as you, the file goes in ~/Library/LaunchAgents/ and should be named <label>.plist. System-wide daemons go in /Library/LaunchDaemons/ and need root.
  • Check whether a job is loaded with launchctl list | grep <label>. Unload the job before editing its file, then load it again.
  • In the calendar schedule, weekday 0 or 7 means Sunday. A field left blank or * matches any value.

Common questions

Where do I put the .plist file?

For jobs that run as you, save it in ~/Library/LaunchAgents/. System-wide daemons go in /Library/LaunchDaemons/ (requires root). Then run launchctl load on the file.

How do I stop or remove a job?

Run launchctl unload ~/Library/LaunchAgents/<label>.plist, then delete the file. Use launchctl list | grep <label> to check whether it is loaded.

Why not just use cron?

macOS still ships cron, but launchd is the native scheduler: it handles sleep/wake correctly, can run jobs at login, restart crashed jobs with KeepAlive, and is what Apple tooling expects.