Restart Mac From Command Line

By  on  

Restarting and shutting down a computer remotely is a frequent task for remote system administrators. As someone that writes many shell scripts, I also find myself automating system restarts. Let's look at a few ways to restart Mac systems from command line!

Restart a Local Mac

To restart a local Mac system from command line, you can execute:

sudo shutdown -r now

Restart a Remote Mac

To restart a remote Mac system, you can execute:

ssh -l {AdminSystemAddress}
sudo shutdown -r now

Restart at a Specific Time

You can specify a restart at a specific time:

# Format:  sudo shutdown -r hhmm
# Restart at 11:30pm local time
sudo shutdown -r 2330

System restarts are good after massive updates or just for clearing out system resources. These command line examples should help restart a Mac locally or remotely.

Recent Features

  • By
    Regular Expressions for the Rest of Us

    Sooner or later you'll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...

  • By
    Animated 3D Flipping Menu with CSS

    CSS animations aren't just for basic fades or sliding elements anymore -- CSS animations are capable of much more.  I've showed you how you can create an exploding logo (applied with JavaScript, but all animation is CSS), an animated Photo Stack, a sweet...

Incredible Demos

  • By
    TextboxList for MooTools and jQuery by Guillermo Rauch

    I'll be honest with you: I still haven't figured out if I like my MooTools teammate Guillermo Rauch. He's got a lot stacked up against him. He's from Argentina so I get IM'ed about 10 times a day about how great Lionel...

  • By
    Get Slick with MooTools Kwicks

    When I first saw MooTools graphical navigation, I was impressed. I thought it was a very simple yet creative way of using Flash. When I right-clicked and saw that it was JavaScript, I was floored. How could they achieve such...

Discussion

    Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!