Articles
Published · November 18, 2026

Cron Syntax on a Mac: The Five Fields and What launchd Does Instead

A crontab line has five time fields and then a command. Here is how to read each field, where cron surprises people, and what launchd does instead on macOS.

Also in: Español中文हिन्दी

A crontab line is five time fields followed by a command: minute, hour, day of month, month, day of week. On a Mac, cron still works, but Apple's documentation calls it deprecated and names launchd as the preferred way to run timed jobs.

We'll read the five fields one at a time, flag the one rule that trips people up, and show the launchd version of the same schedule. The running example is a nightly copy of a notes folder.

Quick answer

Here is a line that runs a backup script at 2:30 every morning:

30 2 * * * /Users/you/bin/backup-notes.sh

Read it left to right: minute 30, hour 2, any day of the month, any month, any day of the week, then the command. The asterisk means "every value" for that field.

The five fields

Each field has a fixed range, per the crontab(5) manual page:

| Position | Field | Allowed values | |---|---|---| | 1 | Minute | 0-59 | | 2 | Hour | 0-23 | | 3 | Day of month | 1-31 | | 4 | Month | 1-12 (or names) | | 5 | Day of week | 0-7 (0 and 7 are both Sunday, or names) |

Hours use the 24-hour clock, so 2 is 2 a.m. and 14 is 2 p.m. In a user crontab the command is the sixth item on the line. System files such as /etc/crontab add a username before the command.

Special characters

Four characters cover nearly every schedule:

  • * means every value in the field.
  • A comma makes a list: 1,15 is the 1st and the 15th.
  • A hyphen makes an inclusive range: 9-17 is 9 through 17.
  • A slash sets a step: */10 in the minute field is every ten minutes.

Names work in the month and day-of-week fields only, such as mon,wed,fri or jan-mar, and they are case-insensitive.

Steps deserve a second look. The manual page notes that steps are evaluated inside the field they sit in, so */23 in the hour field means hours 0 and 23, not "every 23 hours". Wikipedia's cron article adds that only steps that divide the range evenly give evenly spaced runs.

Other characters you may see online, such as L, W, #, and ?, exist only in some implementations. Don't expect them in a standard crontab.

The day-of-month trap

When you restrict both the day-of-month and day-of-week fields, cron runs the job when either one matches. It does not require both.

30 4 1,15 * 5 /Users/you/bin/backup-notes.sh

The manual page uses this exact example: it runs at 4:30 on the 1st and 15th of each month, plus every Friday. If you wanted only the Fridays that fall on the 1st or 15th, cron can't express that in one line. Leave one of the two fields as * unless you want the "either" behavior.

Shortcut strings

Many cron implementations accept a shortcut in place of the five fields:

  • @hourly is 0 * * * *
  • @daily is 0 0 * * *
  • @weekly is 0 0 * * 0
  • @monthly is 0 0 1 * *
  • @yearly is 0 0 1 1 *
  • @reboot runs once at startup

These are not part of the original five-field format, and support varies. Run man 5 crontab on your Mac to see what your version accepts. They suit weekly notes routines well, but check before you rely on one.

What launchd does instead

Apple's archived guide to scheduling timed jobs says the preferred way to add a timed job is launchd, and that cron "is still supported" but "has been deprecated in favor of launchd". That page was last updated in 2016, so treat it as the documented position rather than a fresh announcement.

Each launchd job lives in its own file, so you add or remove a job by adding or removing a file. There is no shared crontab to edit. The file is a property list, and the schedule goes in a StartCalendarInterval dictionary:

<?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.backup-notes</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Users/you/bin/backup-notes.sh</string>
    </array>
    <key>StartCalendarInterval</key>
    <dict>
        <key>Hour</key>
        <integer>2</integer>
        <key>Minute</key>
        <integer>30</integer>
    </dict>
</dict>
</plist>

The sub-keys are Minute, Hour, Day, Month, and Weekday, the same five ideas as cron. A key you leave out acts like an asterisk. This is the same 2:30 a.m. schedule as the crontab line above. Apple's own example, a job that runs at midnight on July 11 when it falls on a Sunday, uses Weekday 0 for Sunday.

Personal launchd jobs usually live in ~/Library/LaunchAgents. Load one with launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.example.backup-notes.plist.

Sleep and power-off behavior

Here's the practical difference. Per Apple's guide, cron jobs do not run while the Mac is asleep or off; they wait for the next scheduled time. A launchd job scheduled with StartCalendarInterval runs when the Mac wakes if it was asleep at the scheduled time.

If the Mac is powered off, neither one runs until the next scheduled time. Apple's example is blunt: a 1 a.m. job never runs if you always shut down at night. For a laptop that sleeps overnight, launchd is the more forgiving choice.

A nightly notes backup, both ways

The script is the same either way. Make it a script with a shebang line, mark it executable, and point cron or launchd at its full path.

  • Cron: 30 2 * * * followed by the script path. One line in crontab -e.
  • launchd: the plist above, one file per job.

Cron is shorter to write and easier to scan. launchd takes more lines, but it handles sleep better and keeps each job separate.

How Carets fits in

A crontab and a launchd plist are both plain text, and the quickest way to break either is a typo you can't see. Carets is a native notes and code editor for iPhone, iPad, and Mac that handles plain text and code with syntax highlighting, so a plist's XML and a backup script read clearly. You can keep your scheduled-job files, the scripts they call, and your notes about them together in files, projects, and tags, and they stay plain text you can move anywhere.

Download Carets on the App Store for iPhone, iPad, and Mac.

Frequently Asked Questions

Does cron still work on a Mac?

Yes. Apple's archived documentation says cron is still supported but deprecated in favor of launchd. It works, but launchd is the documented preferred route.

What does * * * * * mean?

Five asterisks mean every minute of every hour of every day, because * stands for all values in each field.

Will a cron job run while my Mac is asleep?

No. Cron jobs do not run while the Mac is asleep or off. A launchd job that uses StartCalendarInterval runs on wake if the Mac was asleep at the scheduled time, but not if it was powered off.