Everywhere All articles Download

Command line and power tools

The Mac's native scheduler, put to work

Updated 2026-08-08 · 5 min read

cron exists on the Mac but launchd is the native scheduler — and the difference matters on a laptop, because launchd runs a missed job when the machine wakes instead of skipping the week.

The example: archive stale downloads weekly

The job: files sitting in Downloads for over 60 days move to an archive folder. The script, saved as ~/bin/sweep-downloads.sh and made executable:

#!/bin/bash
mkdir -p ~/Downloads/Archive
find ~/Downloads -maxdepth 1 -type f -mtime +60   -exec mv {} ~/Downloads/Archive/ \;

(-maxdepth 1 leaves the Archive folder itself alone. Moving, not deleting — scheduled deletion should be earned, not defaulted.)

The LaunchAgent

Jobs for your user live in ~/Library/LaunchAgents. Create com.user.sweep-downloads.plist:

<?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.user.sweep-downloads</string>
  <key>ProgramArguments</key>
  <array><string>/Users/YOURNAME/bin/sweep-downloads.sh</string></array>
  <key>StartCalendarInterval</key>
  <dict><key>Weekday</key><integer>1</integer>
        <key>Hour</key><integer>9</integer></dict>
  <key>StandardErrorPath</key>
  <string>/tmp/sweep-downloads.err</string>
</dict></plist>

Load it:

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.user.sweep-downloads.plist

StartCalendarInterval here means Mondays at 09:00 — and if the Mac was asleep then, the job runs on wake. That catch-up behaviour is the argument for launchd over cron on anything with a lid.

Debugging the inevitable silence

The job did not run, or ran invisibly. In order:

launchctl list | grep sweep
launchctl kickstart gui/$(id -u)/com.user.sweep-downloads
cat /tmp/sweep-downloads.err

— is it loaded, run it now, read what it said. Most failures are the script path (must be absolute), permissions (the script not executable, or the shell lacking Full Disk Access for protected folders), or editing the plist without re-bootstrapping it.

Common questions

Why use launchd instead of cron on a Mac?

launchd catches up on jobs missed during sleep and is what macOS itself uses; cron silently skips anything scheduled while the lid was closed.

Can launchd watch a folder instead of a schedule?

Yes — WatchPaths triggers the job when a path changes, which suits react-to-arrival tasks better than polling.

Find any file before you finish typing

Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.

Download for Mac

Version 2.15.7 · macOS 13+ · 3.8 MB · notarised

Related

© 2026 Caretopia Network Private Limited Everywhere for Mac Articles Privacy Support