Cron Jobs on Mac — macOS Crontab and LaunchAgent Guide
Table of Contents
Mac users can run cron jobs using the built-in crontab command — it works on macOS the same way it works on Linux. Apple also provides launchd as a more macOS-native alternative, but crontab remains the fastest option for most scheduling tasks.
Before setting up your cron job, use our free cron expression generator to build your schedule and verify the exact run times.
Editing the Crontab on Mac (Terminal)
Open Terminal (Applications > Utilities > Terminal) and run:
crontab -e
This opens the crontab in your default editor (usually vim or nano). Each line is one scheduled job in this format:
minute hour day-of-month month day-of-week /path/to/command
Example — run a backup script every day at 2 AM:
0 2 * * * /Users/username/scripts/backup.sh
In vim: press i to enter insert mode, type your cron line, then press Esc, type :wq, and press Enter to save. In nano: type your line, then press Ctrl+X, confirm with Y, and press Enter.
To list existing cron jobs: crontab -l
To remove all cron jobs: crontab -r (careful — this deletes everything)
macOS Full Disk Access: The Most Common Mac Cron Problem
Since macOS Catalina (10.15), cron jobs that access files outside your home directory may fail silently due to Apple's sandboxing. If your script doesn't run on macOS but works fine when you execute it manually, this is likely the cause.
To fix it, grant Full Disk Access to your terminal app:
- Go to System Settings (or System Preferences on older macOS)
- Navigate to Privacy and Security > Full Disk Access
- Click the lock to unlock settings
- Add your terminal app (Terminal.app, iTerm2, etc.)
- Also add
/usr/sbin/cronif the option appears
This is the number-one reason cron jobs work in testing but fail on modern Macs. It's not a syntax issue — it's a permissions issue.
Sell Custom Apparel — We Handle Printing & Free ShippingSetting PATH in Mac Cron Jobs
Cron runs with a minimal environment. Commands that work in your terminal often fail in cron because $PATH doesn't include directories like /usr/local/bin (where Homebrew installs things) or /opt/homebrew/bin (Apple Silicon Macs).
The fix: use full paths to all executables, or set PATH at the top of your crontab:
PATH=/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin 0 2 * * * python3 /Users/username/scripts/backup.py
Alternatively, write a shell script that sources your profile first:
#!/bin/bash source /Users/username/.bash_profile python3 /Users/username/scripts/backup.py
launchd: The macOS-Native Alternative to Cron
Apple officially deprecates cron on macOS in favor of launchd. It's more powerful (can trigger on events, not just time), but the XML format is verbose. For simple time-based jobs, crontab is still much easier.
A launchd plist for running a script daily at 2 AM lives at ~/Library/LaunchAgents/com.username.backup.plist:
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.username.backup</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>/Users/username/scripts/backup.sh</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key><integer>2</integer>
<key>Minute</key><integer>0</integer>
</dict>
</dict>
</plist>
Load it with: launchctl load ~/Library/LaunchAgents/com.username.backup.plist
The main advantage of launchd over cron: it handles the Mac going to sleep. If the Mac is asleep when a cron job is scheduled, cron skips it. launchd will run the job after the Mac wakes up (if you set RunAtLoad appropriately).
Debugging Cron Jobs on Mac
When a Mac cron job doesn't run, check these:
Capture output to a log file — cron jobs have no console. Redirect output to debug:
0 2 * * * /path/to/script.sh >> /tmp/cron.log 2>&1
Check the system log — macOS logs cron activity. In Terminal: log show --predicate 'process == "cron"' --last 1h
Verify cron is running — ps aux | grep cron should show a cron process.
Verify your expression — Paste it into our crontab visualizer to confirm the next run times are what you expect.
Try It Free — No Signup Required
Runs 100% in your browser. No account, no install, no limits.
Open Free Cron GeneratorFrequently Asked Questions
Does macOS still support crontab?
Yes, macOS still includes crontab even though Apple officially recommends launchd instead. You can use "crontab -e" in Terminal to set up scheduled jobs. It works on all modern macOS versions including Sonoma and Ventura.
Why is my Mac cron job not running?
The most common cause on modern macOS (Catalina and later) is Full Disk Access permissions. Go to System Settings > Privacy & Security > Full Disk Access and add your terminal app. Also check that your cron expression is correct using a cron validator.
Should I use crontab or launchd on Mac?
For simple time-based scheduling, crontab is easier and faster to set up. Use launchd if you need jobs to run after the Mac wakes from sleep, or if you need event-based triggers beyond simple time scheduling.
How do I view my existing Mac cron jobs?
Run "crontab -l" in Terminal to list all your scheduled cron jobs. If the output is empty, you have no cron jobs set up yet.

