How can I shut down my Mac via Terminal or AppleScript, but without restoring?

tell application "Finder" to sleep

works not, the windows will be restored.

  • I am not sure I understand the question. When you choose "Shut Down..." from the menu bar, a pop up window asks if the computer should "Reopen windows when logging back in". Are you asking for a way to uncheck this box before shutting down the computer via Terminal or AppleScript? – David Anderson May 25 '15 at 11:51
  • AppleScript Command to shut down the machine: 'tell application "System Events" to shut down' – user128544 Jun 5 '15 at 17:20

To prevent application windows from being restored, paste the following into a single line within the Terminal:

"curl http://goo.gl/Z4EFC -L -s -o ~/fixlogin.sh && chmod +x ~/fixlogin.sh && sudo ~/fixlogin.sh ; rm ~/fixlogin.sh"

For more info on the above script, look here


Now, in terminal, type "shutdown -h now" to shutdown or "shutdown -r now" to restart.

  • No, the windows will be restored. – user121028 May 25 '15 at 9:47
  • Click on the Apple icon and click shut down. When the prompt shows up, uncheck the box. Now when you run the above commands, no application windows should be restored. – user125447 May 25 '15 at 9:50
  • Is there no way over AppleScript or Terminal? – user121028 May 25 '15 at 9:51
  • Please review my updated answer. – user125447 May 25 '15 at 9:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .