# MacOS Launch Agents Think of launch agents as a task scheduling system for MacOS. A launch agent is defined using a plist file stored in `/Users/<USER NAME>/Library/LaunchAgents`. After making a launch agent you need to load it using `launchctl` like so: `launchctl load -w <PATH TO PLIST>`. `-w` is used to make sure the plist is persistent.[^1] [^1]: Read this online somewhere, various other sources include it as well making it seem important. The docs about this option are unfortunately cryptic however. To unload call `launchctl unload`. To start an agent explicitly use `launchctl unload <LABEL>`. Note `load` and `unload` take the path to the plist file, while `start` takes the job label instead (in the form com.company...). When using launch agents it's a good idea to pack any scripts into an Automator app, which will allow you to grant the specific app access permissions (say Desktop, full disk, etc.). For sample launch agents see: - [[Scheduling Restic Backups with a Launch Agent on MacOS]] - [[Signing Git Commits With SSH Keys#`SSH_AUTH_SOCK` for GUI applications]] - [[Setting Environment Variables on MacOS]]