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:
| Goal | Command |
|---|---|
| Restart now | sudo shutdown -r now |
| Shut down (power off) now | sudo shutdown -h now |
| Sleep now | sudo shutdown -s now or pmset sleepnow |
| Restart in 30 minutes | sudo shutdown -r +30 |
| Restart at 11 PM tonight | sudo shutdown -r 2300 |
| Restart without the polite steps | sudo 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, so2300means 11:00 PM today. If 11 PM has already passed,shutdownassumes 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 -rlogs the event, warns users, and then askslaunchdto restart the system. This is the normal, clean path.rebootflushes 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.