Home/Q&A/Can I schedule tasks on a rented Mac mini, and should I use cron or launchd?

Can I schedule tasks on a rented Mac mini, and should I use cron or launchd?

Updated · airankrush

Direct answer

Yes. cron and launchd both come with the system and work out of the box. For tasks that operate desktop apps, choose a per-user launchd job. For pure scripts either will do; watch the runtime environment and the time zone.

Basis

  • cron still works on macOS; edit it with crontab -e. launchd is Apple's own job management mechanism. Its configuration files go under ~/Library/LaunchAgents, belong to the current user and need no elevated privileges.
  • The two behave differently when a scheduled time is missed. According to the official launchd manual, calendar-based runs missed while the machine was asleep are run after it wakes, with several missed runs merged into one. With cron, a missed run is simply missed. On a machine that stays on and never sleeps the difference is small, but it is worth knowing.
  • Per-user launchd jobs load only after you log in and run inside the login session, so they can open apps and operate windows. System-level daemons do not depend on a login, but they cannot reach the desktop and need elevated privileges to install. You will rarely need them.
  • Scheduled jobs run in a very bare environment. They do not read your terminal configuration, and commands installed with Homebrew are often not found. Write full paths in your scripts, or set PATH yourself at the top.

Information as of .

Boundaries: when the answer is different

Check the machine’s time zone in System Settings → General → Date & Time. Use the city or time zone in your delivery details. The United States has multiple time zones, and some observe daylight saving time. Record the time zone used by logs and scheduled jobs.

How to do it

  1. Run the script by hand in a terminal from start to finish first, with an absolute path for every command.
  2. Confirm the system time zone and decide which clock your times refer to.
  3. Write the launchd configuration or the crontab entry, and point both standard output and standard error at a log file.
  4. Temporarily set the trigger time a few minutes ahead, verify the job really ran by itself, then change it back to the real time.
  5. Read the log the next day to confirm it also ran on time while nobody was connected.

Use case

This question belongs to the use case: Mac mini for 24/7 AI agents? Only worth it when the agent needs a desktop or macOS apps

Other questions in the same use case:

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All Q&A