A blog for technology, SEO tips, website development and open source programming.

Shutdown your Mac using a terminal command

1 1,768

The shutdown command comes in handy if you want to shutdown or reboot your Mac at a specific time. Here are some of the examples. You should be a super user to use these commands.

sudo shutdown [options] when [message]

Some examples.
Shutdown immediately:

sudo shutdown -h now

Restart immediately:

sudo shutdown -r now

Shutdown at 9 pm:

sudo shutdown -h 21:00

Shutdown in 5 minutes:

sudo shutdown -h +5

Restart immediately

sudo reboot

Shutdown immediately

sudo halt

If you are not an admin user non of the above commands are going to help. If that’s the case try the following commands.
Shutdown immediately:

osascript -'tell application "System Events" to shut down'

Restart immediately:

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

Sleep:

osascript -'tell application "System Events" to sleep'

Logout:

osascript -'tell application "System Events" to log out'

 

1 Comment
  1. […] Shutdown your Mac using a terminal command […]

Leave a Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More