Terminal

How to Restart Mac from Terminal (shutdown -r now)

Published Nov 10, 2026
Tested on a real Mac. Ran which/ls -i on /sbin/shutdown, reboot and halt, non-root shutdown (no args and -r +60), uptime, sysctl kern.boottime, last reboot, pmset -g sched, pgrep, and read the shutdown, reboot and pmset man pages on an M3 Mac (macOS 26.6.2, zsh 5.9); no sudo command was executed and the Mac was never actually restarted or shut down, so the sudo shutdown, reboot, pmset schedule and osascript restart steps were not executed. Test machine: MacBook Air (M3, 16 GB), macOS Tahoe 26.6.2, zsh 5.9.
On this page
  1. The restart and shutdown commands
  2. Why it says “NOT super-user”
  3. Restart on a timer (and how to cancel it)
  4. shutdown vs reboot: which is safer?
  5. Restart with osascript (asks apps to save)
  6. Can pmset schedule a restart?
  7. Check when the Mac last restarted
  8. Common questions

To restart a Mac from Terminal, run:

sudo shutdown -r now

Type your login password when asked and the Mac restarts right away. To shut it down instead, use sudo shutdown -h now. Both need sudo; without it, shutdown refuses to do anything.

I checked every command below on a MacBook Air M3 running macOS Tahoe 26.6.2. Because this is a working machine, I did not actually restart it, and I did not run anything with sudo. What I did run is marked with real output, and the rest comes straight from the man pages on this Mac.

The restart and shutdown commands

macOS ships the classic BSD tools in /sbin:

which shutdown reboot halt
/sbin/shutdown
/sbin/reboot
/sbin/halt

Here is the short version of what each one is for:

GoalCommand
Restart nowsudo shutdown -r now
Shut down (power off) nowsudo shutdown -h now
Sleep nowsudo shutdown -s now or pmset sleepnow
Restart in 30 minutessudo shutdown -r +30
Restart at 11 PM tonightsudo shutdown -r 2300
Restart without the polite stepssudo reboot

-h and -p do the same thing on macOS: halt and power off. -s is a Mac-specific extra that puts the machine to sleep at the given time.

Why it says “NOT super-user”

If you forget sudo, you get this:

shutdown -r +60
shutdown: NOT super-user

The exit code is 1 and nothing is scheduled. One thing I did not expect: running shutdown with no arguments at all prints the same error instead of a usage message. The permission check happens before macOS even looks at your options. So if you are trying to read the usage line, use man shutdown instead.

The fix is simply to add sudo in front. Terminal will ask for your Mac login password. Nothing shows while you type; that is normal.

Restart on a timer (and how to cancel it)

The time argument takes three forms:

  • now — immediately.
  • +number — in that many minutes, for example +30. You can add a unit: +90s, +2h, +10min.
  • yymmddhhmm — an absolute time. You can drop the date part, so 2300 means 11:00 PM today. If 11 PM has already passed, shutdown assumes tomorrow.
sudo shutdown -r +30 "Restarting for updates"

The text at the end is a warning message. It is broadcast to everyone logged in to the Mac (for example over SSH), and five minutes before the restart macOS blocks new logins by creating /var/run/nologin.

Cancelling is the part most guides get wrong. Linux has shutdown -c. macOS does not; there is no -c flag in the man page. A timed shutdown is just a shutdown process waiting in the background, and the man page says to cancel it by killing that process:

pgrep -lx shutdown
sudo pkill -x shutdown

pgrep lists the waiting process (on my Mac it printed nothing and exited with 1, because nothing was scheduled). Killing it with the default SIGTERM cancels the restart and removes /var/run/nologin again. Use -x so pkill matches the exact name shutdown and nothing else.

shutdown vs reboot: which is safer?

ls -i shows something interesting about reboot and halt:

ls -i /sbin/halt /sbin/reboot
1152921500312571465 /sbin/halt
1152921500312571465 /sbin/reboot

Same inode number, so they are literally the same program under two names (a hard link). The name you type decides whether it restarts or powers off.

The real difference is between shutdown and reboot:

  • shutdown -r logs the event, warns users, and then asks launchd to restart the system. This is the normal, clean path.
  • reboot flushes the disk cache, sends every process a SIGTERM and then a SIGKILL, and restarts. It skips the warnings and the timer.

Neither one waits for apps to ask “Do you want to save changes?”. Open documents with unsaved edits can be lost. If that matters, use the next method.

Restart with osascript (asks apps to save)

This is the Terminal version of choosing Apple menu → Restart:

osascript -e 'tell application "System Events" to restart'

It does not need sudo. Apps get the normal quit request, so one with unsaved work will show its save dialog and can stop the restart. The shut down and log out versions follow the same pattern:

osascript -e 'tell application "System Events" to shut down'
osascript -e 'tell application "System Events" to log out'

The first time you run this from Terminal, macOS may ask you to allow Terminal to control “System Events”. You can review that later in System Settings → Privacy & Security → Automation.

Use osascript when you are at the Mac and want the safe, polite restart. Use sudo shutdown -r now for remote Macs over SSH, scripts, or when an app is hanging and you want the restart to go through no matter what.

Can pmset schedule a restart?

Not directly. pmset can schedule one-time and repeating power events, but the man page on Tahoe lists only these types:

type - one of sleep, wake, poweron, shutdown, wakeorpoweron

There is no restart. The workaround is a scheduled shutdown plus a scheduled power on:

sudo pmset repeat shutdown MTWRF 23:00:00 poweron MTWRF 07:00:00

You can check what is already scheduled without sudo:

pmset -g sched
Scheduled power events:
 [0]  wake at 11/10/2026 15:55:33 by 'com.apple.alarm.user-invisible-com.apple.calaccessd.travelEngine.periodicRefreshTimer'
 [1]  wake at 11/11/2026 08:55:21 by 'com.apple.alarm.user-invisible-com.apple.osanalytics.hardhighengagementtimer'

Those two entries are wake events macOS set by itself. Clear your own events with sudo pmset repeat cancel (repeating) or sudo pmset schedule cancelall (one-time).

Check when the Mac last restarted

After a restart, or before you decide one is needed, these three commands work without sudo:

uptime
sysctl kern.boottime
last reboot
10:55  up 66 days,  9:38, 3 users, load averages: 1.95 2.86 3.06
kern.boottime: { sec = 1788538623, usec = 900956 } Sat Sep  5 01:17:03 2026
reboot time                                Sat Sep  5 01:16

Yes, my test Mac had been up for 66 days. kern.boottime gives the exact second, which is handy in scripts. last shutdown printed nothing here, even though the Mac had restarted, so do not rely on it to tell you how the last restart happened.

If a long uptime goes with a slow Mac, a restart often helps. Before that, it is worth checking what is using your RAM. And if you want the opposite of a timed shutdown, caffeinate keeps the Mac awake for as long as you say.

Common questions

What is the Terminal command to restart a Mac?

sudo shutdown -r now. Type your login password when asked. sudo reboot also works but skips the clean shutdown steps.

How do I shut down a Mac from Terminal?

sudo shutdown -h now. For a timer, replace now with +60 (one hour) or a time like 2300.

How do I cancel a scheduled shutdown on Mac?

Kill the waiting process with sudo pkill -x shutdown. macOS has no shutdown -c like Linux does.

Can I restart a Mac from Terminal without a password?

osascript -e 'tell application "System Events" to restart' does not need sudo, but it only works for the user logged in at the screen and apps can block it. For shutdown you need an admin password unless an admin has set up a sudoers rule for it.

Does restarting from Terminal install pending macOS updates?

No. shutdown -r simply restarts. Updates are installed through System Settings → General → Software Update or the softwareupdate command.