What is the macOS shutdown command?

The shutdown command is a built-in macOS utility that powers off, restarts, or puts the computer to sleep from the Terminal. It accepts flags that control the action, a time argument that schedules when it should run, and an optional broadcast message displayed to logged-in users before the operation starts.

Because shutdown modifies system state, it normally requires administrator privileges and is invoked with sudo. It is commonly used by administrators to plan maintenance windows, by power users to automate end-of-day routines, and by scripts that need a reliable way to halt or reboot a Mac without extra software.

Tool description

This tool builds a valid macOS shutdown command from a simple form. Pick an action, choose when it should run, optionally add a broadcast message and advanced flags, and copy the generated command into a terminal or shell script.

Examples

Immediate halt (power off):

sudo shutdown -h now

Reboot in 5 minutes with a message to users:

sudo shutdown -r +5 "Rebooting for maintenance"

Sleep at a specific date and time (April 30, 2026 at 23:00):

sudo shutdown -s 2604302300

Warn users without halting (broadcast only):

sudo shutdown -k +10 "Please save your work"

Cancel a previously scheduled shutdown:

sudo killall shutdown

Features

  • Generate commands for halt, reboot, sleep, warn-only, and cancel actions
  • Schedule the action immediately, after N minutes, or at an absolute date and time
  • Add a broadcast message shown to logged-in users
  • Toggle sudo, -n (no fsck/sync), and -o (don't send SIGTERM to processes)
  • Live preview of the generated command, ready to copy into a terminal or script

Use cases

  • Schedule an overnight reboot after installing system updates on a workstation
  • Trigger a clean shutdown from a launchd job or maintenance script at a fixed time
  • Warn logged-in users that a shared Mac will be powered down before halting it

Options explained

  • Action — Selects the operation: halt (-h), reboot (-r), sleep (-s), warn-only (-k), or cancel a pending shutdown (killall shutdown).
  • Time modeNow uses the literal now, In minutes uses +N, At date and time produces the absolute yymmddhhmm form expected by shutdown(8).
  • Message — Appends a quoted broadcast message; embedded quotes are escaped and newlines are stripped.
  • Use sudo — Prefixes the command with sudo so it runs with the required administrator privileges.
  • No fsck / no sync (-n) — Skips the filesystem sync before halting. Faster, but generally not recommended on healthy systems.
  • No SIGTERM (-o) — Tells shutdown not to send SIGTERM to processes before bringing the system down. Use with care.

How it works

Under the hood, shutdown(8) schedules a system transition. The time argument can be:

  • now — run immediately
  • +N — run N minutes from now
  • yymmddhhmm — run at the absolute date/time encoded as 2-digit year, month, day, hour, and minute

macOS does not provide a native -c cancel flag like Linux. To cancel a pending shutdown, you terminate the scheduled shutdown process itself with sudo killall shutdown, which this tool generates for you when the Cancel action is selected.

Tips

  • Always test the command on a non-critical machine first; halting or rebooting will close all running applications.
  • Use the Warn action to notify users without actually shutting down — useful for dry runs.
  • When scheduling at an absolute time, double-check the date is in the future; past times are rejected by shutdown.
  • Run from an interactive Terminal so sudo can prompt for your password, or configure passwordless sudo for shutdown if invoking from automated scripts.