Plist templates

Starter LaunchAgent plists for common patterns. Download a file or copy the XML, then edit paths and Label before loading.

User Agents: save to ~/Library/LaunchAgents/ and run launchctl load ~/Library/LaunchAgents/your.plist. Change com.example.* to your own reverse-DNS label.

Run script at login

User Agent · RunAtLoad

Download

Runs once when the agent is loaded — typical for login-time setup scripts that exit when finished.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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.run-at-login</string>
	<key>ProgramArguments</key>
	<array>
		<string>/bin/sh</string>
		<string>-c</string>
		<string>/path/to/your/script.sh</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
	<key>KeepAlive</key>
	<false/>
</dict>
</plist>

Daily schedule

User Agent · StartCalendarInterval

Download

Runs every day at 09:00. Adjust Hour and Minute, or add Weekday for weekly jobs.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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.daily-schedule</string>
	<key>ProgramArguments</key>
	<array>
		<string>/bin/sh</string>
		<string>-c</string>
		<string>/path/to/your/backup.sh</string>
	</array>
	<key>StartCalendarInterval</key>
	<dict>
		<key>Hour</key>
		<integer>9</integer>
		<key>Minute</key>
		<integer>0</integer>
	</dict>
	<key>StandardOutPath</key>
	<string>/tmp/com.example.daily-schedule.log</string>
	<key>StandardErrorPath</key>
	<string>/tmp/com.example.daily-schedule.log</string>
</dict>
</plist>

Interval job

User Agent · StartInterval

Download

Runs every 3600 seconds (1 hour). Also runs once at load when RunAtLoad is true.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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.interval-job</string>
	<key>ProgramArguments</key>
	<array>
		<string>/bin/sh</string>
		<string>-c</string>
		<string>/path/to/your/sync.sh</string>
	</array>
	<key>StartInterval</key>
	<integer>3600</integer>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardOutPath</key>
	<string>/tmp/com.example.interval-job.log</string>
	<key>StandardErrorPath</key>
	<string>/tmp/com.example.interval-job.log</string>
</dict>
</plist>

Keep-alive process

User Agent · KeepAlive

Download

Keeps a long-running process alive — dev servers, workers, or local APIs. launchd restarts it if it exits.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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.keepalive-process</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/local/bin/node</string>
		<string>server.js</string>
	</array>
	<key>WorkingDirectory</key>
	<string>/path/to/your/project</string>
	<key>KeepAlive</key>
	<true/>
	<key>RunAtLoad</key>
	<true/>
	<key>StandardOutPath</key>
	<string>/tmp/com.example.keepalive-process.log</string>
	<key>StandardErrorPath</key>
	<string>/tmp/com.example.keepalive-process.log</string>
</dict>
</plist>

Watch path

User Agent · WatchPaths

Download

Runs your script when files change in a watched directory — useful for config reloads or simple file triggers.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//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.watch-path</string>
	<key>ProgramArguments</key>
	<array>
		<string>/bin/sh</string>
		<string>-c</string>
		<string>/path/to/your/reload.sh</string>
	</array>
	<key>WatchPaths</key>
	<array>
		<string>/path/to/watch</string>
	</array>
	<key>RunAtLoad</key>
	<false/>
	<key>StandardOutPath</key>
	<string>/tmp/com.example.watch-path.log</string>
	<key>StandardErrorPath</key>
	<string>/tmp/com.example.watch-path.log</string>
</dict>
</plist>