As a DevOps engineers, we must get used to running commands from the Terminal. Let’s see how easy and fast we can shutdown and restart a macOS machine after long day of work.
Prerequisites
- macOS shell environment
- sudo privileges
Solutions
Shutdown a macOS machine
Open Terminal and run the following command:
sudo shutdown -h now
or, if you want to shut it down after 15 minutes, use the following command instead:
sudo shutdown -h +15
Restart a macOS machine
Open Terminal and run the following command:
sudo shutdown -r now
You could add minutes or hours when restarting the machine too. For instance:
sudo shutdown -r +60
Conclusion
TL;DR a single command shutdown
that takes parameters: -h
for shutdown, -r
for restart and -s
for sleep. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.