Thursday, April 3, 2008

Shutdown or Reboot the Mac using command line

I'm not sure if its only me, but I sometimes have trouble shutting down, or rebooting my Mac. I have all the latest patches, but yet I still sometimes encounter situations where after I hit the shutdown option, it just hang there. I could even launch applications after I have shutdown. Luckily, there is a way to shutdown/reboot the Mac from the command line.

To do that, do the following:
  1. Launch the application Terminal. You can find it in the Applications folder, or Spotlight
  2. Type sudo shutdown -h now to shutdown, or sudo shutdown -r now to reboot
  3. Enter the password of the current user account that you have login.

That's all to it. Hope it helps...

10 comments:

Anonymous said...

even shorter:
sudo halt

chantc said...

If I understand correct, the Mac halt will kill processes off to shutdown the machine.

The shutdown command will instead shutdown processes cleanly, so that there will be less chances of any corruption.

Anonymous said...

Erm, why not just press and hold the power button for > 5 secs?
Then the Mac will force shutdown.

chantc said...

This is more for techies that who needs to shutdown the mac remotely. :)

Anonymous said...

Unquestionably believe that which you stated. Your favorite justification seemed to be on the net the easiest thing to be aware of. I say to you, I definitely get annoyed while people think about worries that they plainly don't know about. You managed to hit the nail upon the top and also defined out the whole thing without having side effect , people could take a signal. Will probably be back to get more. Thanks

Anonymous said...

Thank you for the tip! You just saved my life :) I couldn't reboot (really) remote computer because things went really wrong there. I did reboot from the command line as you suggested though.

Again, thank you!

Anonymous said...

Likewise, thanks for posting this - saved me a journey!

Anonymous said...

Is it possible to restart the mac in a specific mode from terminal? For example, type some code in termainl that tells the mac to shut down, and when it reboots to reboot in safe mode or recovery mode etc? I have a non supported GFX card in so I don't see anything until osx has loaded. Hope that makes sense?

Unknown said...

If I want to shutdown the Mac through terminal and that too a schedule shutdown. What is the command?

Kyle said...

A cron job can be configured to run a task on startup or shutdown and run a script file.

Visit Rhinestic's Knick Knacks @ Etsy for handmade goods and supplies!

Related Posts Plugin for WordPress, Blogger...