Direct answer
Prefer launchd. cron still works on macOS, but it does not make up for a missed run and is stopped by the privacy system when it touches protected folders. Jobs that operate the interface especially belong in a user-level LaunchAgent.
Basis
- launchd is macOS's own job manager; cron is kept for compatibility. A launchd job triggered by calendar time will run once after wake if the system was asleep at the scheduled moment; with cron, a missed run is simply missed.
- Entries in
~/Library/LaunchAgentsrun inside your login session, so they can show dialogs, send Apple Events and do UI scripting. Processes started by cron are not in that graphical session and often fail when they callosascriptto control an app. - Privacy permissions are counted by who started the process. When a cron job reads Documents, Desktop or other protected data, the permission is requested for the cron system program itself, and many people end up giving it Full Disk Access, which opens the permission very wide.
- A launchd entry can state the log paths, whether to restart after a failure, and the run interval; with cron you have to script all of those yourself.
Boundaries: when the answer is different
Use only the LaunchAgents folder in your own user directory. Do not touch entries in the system-level folders: the platform's management and remote-access components live there, and changing them can leave you unable to connect. User-level jobs start only after the account has logged in, and whether the machine logs in automatically after a restart depends on the delivery configuration, so ask support to check it and do not change login or encryption settings yourself. The machine is not meant to be shut down during the rental, so the difference in making up missed runs mostly shows around maintenance restarts. A mistake in a launchd property list usually means the job silently never runs; after loading it, confirm the entry exists with launchctl list and read the log.
How to do it
- Put the command into a script, write full paths at the top, and do not rely on environment variables from an interactive terminal.
- Create a property list under
~/Library/LaunchAgentswith a label, the script path, the trigger time and two log paths. - Load it with
launchctl, then find the label withlaunchctl list. - Trigger it by hand once, and confirm there is output in the log and the system permission prompts have been dealt with.
- Check the log again after one real trigger time has passed.
Related questions
- iMessage, AppleScript and Shortcuts on a rented Mac mini: it runs, but Apple decides about your account
- How to keep long tasks running on a remote Mac mini after you disconnect
- Can Shortcuts run automatically on a schedule on a remote Mac mini?
- Why does my Mac script work while connected but fail after I disconnect?
- Can I still connect to a remote Mac mini after it restarts?
Use case
This question belongs to the use case: iMessage, AppleScript and Shortcuts on a rented Mac mini: it runs, but Apple decides about your account
Other questions in the same use case:
- Will using iMessage on a rented Mac mini get my Apple account restricted?
- Can I use a rented Mac mini to send bulk iMessage marketing?
- What usually breaks when macOS automation runs unattended for weeks?
- How do I fix AppleScript error -1743, “Not authorized to send Apple events”?
Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support