Quick Tips

Restart a Mac From the Command Line: A Quick Guide

Sometimes the GUI is the slowest path to a reboot. If you're scripting a fleet, fixing a frozen Mac over SSH, or just prefer typing to clicking, restarting from the terminal is the cleanest option.

Quick reference: When to use what

Situation Command Notes
Immediate local restart `sudo shutdown -r now` Prompts for password, warns logged-in users
Restart a remote Mac `ssh` in, then `sudo shutdown -r now` Requires SSH enabled and admin access
Schedule restart at a specific time `sudo shutdown -r hhmm` Uses 24-hour format (e.g., 2330 = 11:30 PM)
Cancel a scheduled restart `sudo killall shutdown` Run before the timer expires
Power off instead of restart `sudo shutdown -h now` Same command, `-h` flag instead of `-r`

The local reboot in one line

Open Terminal and run:

`sudo shutdown -r now`

You'll be prompted for your password because shutdown is a privileged action. The `-r` flag means restart; `now` is the time argument. Replace `-r` with `-h` if you want to power off entirely.

Restarting a Mac over SSH

Useful for sysadmins and remote workers:

“`

Ssh -l adminusername targetmachine

Sudo shutdown -r now

“`

You'll need SSH enabled on the target Mac (System Settings > Sharing > Remote Login) and an admin account. This approach works without needing screen sharing or remote desktop software.

Scheduling a restart for later

The shutdown command accepts a time argument in 24-hour `hhmm` format:

`sudo shutdown -r 2330`

This schedules a restart for 11:30 PM. Cancel anytime with `sudo killall shutdown` before the timer hits zero. Scheduled restarts suit overnight update windows or clearing stuck processes on long-running machines.

When the keyboard is your only option

If your mouse or trackpad is dead but the keyboard works, you can still reboot. On Windows, `Alt + F4` opens the Shut Down Windows dialog when you're focused on the desktop.

  • Press `Windows key + D` to minimise everything and reveal the desktop.
  • Press `Alt + F4` to bring up the shutdown window.
  • Use the arrow keys to pick Restart, then press Enter.

If `Alt + F4` doesn't work, try `Alt + Fn + F4`. Close any open apps first or the shortcut closes the active window instead.

A faster alternative: `Win + X`, then `U`, then `R`. That walks the Power User menu to Restart in three keystrokes—useful but skips the warning dialog.

Our analysis

The command line beats the GUI for repeatable tasks. Once scripted, a restart command scales from one machine to hundreds without clicking through menus on each device. That's the core advantage: automation.

The trade-offs matter. You need admin credentials on the target machine. You can't visually confirm the screen state mid-restart. And on newer macOS versions, an active user session can stall a remote shutdown—the machine waits for manual confirmation rather than forcing through.

What to watch**: macOS sometimes requires interactive shutdown confirmation that a remote `shutdown` command cannot dismiss. For fully unattended restarts, you may need to terminate the user's login session first with a kill signal before invoking shutdown.

Bottom line**: Learn `sudo shutdown -r now`. It'll save you a walk to a stuck machine at least once.

Key takeaways

  • `sudo shutdown -r now` restarts the local Mac immediately.
  • SSH in first, then run the same command for a remote reboot.
  • `sudo shutdown -r hhmm` schedules a restart at a specific local time.
  • On Windows, `Alt + F4` (with focus on the desktop) opens the shutdown menu.
  • Script restarts across many machines with a simple shell loop.

Frequently asked questions

Will `sudo shutdown -r now` warn users first?

Yes. MacOS notifies logged-in users before forcing the reboot.

Can I cancel a scheduled shutdown?

Yes. Run `sudo killall shutdown` to cancel any scheduled `shutdown` command before it fires.

Do I need admin access to reboot a Mac remotely?

Yes. The `shutdown` command requires sudo, and SSH must be enabled on the target Mac.

What's the difference between `-r` and `-h`?

`-r` restarts the machine. `-h` halts and powers it off. Same command syntax, different flag.

Related