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 · Zumac.Ai

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

Schedules fire off the system clock, and times are counted in the machine's system time zone. The machine is in Singapore. If you enter times according to where you are, the job will run at an hour you did not expect, so confirm the time zone in System Settings before writing the schedule. When cron reads or writes protected folders such as Desktop and Documents, the system's privacy protection may block it and you will need to grant access separately. If the machine restarts because of maintenance or a fault, per-user jobs resume only once it is back at the desktop. A schedule firing on time does not mean the third-party service the job calls is available at that moment.

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 @singatao

Back to home · All Q&A

Telegram support