6

Sometimes my computer will crash and restart due to unknown errors. It usually happens when I'm working on something so a few apps are open. OS X has this annoying feature where it tries to reopen all apps when you restart. You can disable it when manually restarting, but it still does it if the computer restarts after a crash.

I think this feature was built to save time, but all it does is waste more time than it's worth, because whenever the computer restarts from a crash I usually just restart it once more (this time with "Reopen apps" disabled) just to get to a workable state. The problem is it'll keep spawning apps and preventing the restart from happening.

Disabling this feature would prevent me having to restart after a crash altogether. Is there a way to stop OS X from doing this?

  • Do you actually want us to help you getting rid of the errors ? – Ruskes May 7 '14 at 0:25
3

Permanently prevent macOS High Sierra from reopening apps after a restart

Works in macOS El Capitan, Yosemite, Sierra, High Sierra.

Solution: deny OS X access to the file it uses to store your session state. It prevents reopening apps even after reboot/shutdown from Terminal, from AppleScript, and system crash.

GUI method

  1. Open Finder
  2. Cmd+Shift+G (Go to folder)
  3. Copypaste ~/Library/Preferences/ByHost/ and confirm
  4. Find the file starting with com.apple.loginwindow
  5. Doubleclick (opens in TextEdit)
  6. Remove all content and save the empty file. An additional confirmation dialog may appear.
  7. Right click, Get Info
  8. Lock the file (check the checkbox)

GUI method (undo)

If you wish to undo this change later and re-enable the feature, simply delete this file and the OS will recreate it.

  1. Open Finder
  2. Cmd+Shift+G (Go to folder)
  3. Copypaste ~/Library/Preferences/ByHost/ and confirm
  4. Locate the file starting with com.apple.loginwindow
  5. Simply delete it

CLI method

  1. Open Terminal.app
  2. Make the file owned by root (otherwise the OS will just replace it)

    sudo chown root ~/Library/Preferences/ByHost/com.apple.loginwindow*
    
  3. Remove all permissions, so it can't be read or written to

    sudo chmod 000 ~/Library/Preferences/ByHost/com.apple.loginwindow*
    

CLI method (undo)

  1. Re-enable "reopen all apps" after login

    sudo rm -f ~/Library/Preferences/ByHost/com.apple.loginwindow*
    
  • Thank you for this great answer! It works well and does not require any user-intervention, such as holding down the [Shift] key when the system is restarting, and is perfect for unattended systems such as those used to support kiosks or information displays which may need to run their own predetermined startup sequence that can be complicated by the system restarting apps in a different order during an automatic login after a power outage. – bluebinary Dec 18 '18 at 20:34
0

Try holding down Shift when you see the login window and release it when the Dock appears.

This prevents items in your login items from starting when you log in but doesn't prevent apps that are resumed.

  • I have no idea why safe login was downvoted here. This is a quick and elegant solution to then get back in and make permanent changes. – bmike Dec 16 '17 at 0:32

You must log in to answer this question.

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