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?
Best Answer
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
Cmd+Shift+G
(Go to folder)~/Library/Preferences/ByHost/
and confirmcom.apple.loginwindow
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.
Cmd+Shift+G
(Go to folder)~/Library/Preferences/ByHost/
and confirmcom.apple.loginwindow
CLI method
Make the file owned by root (otherwise the OS will just replace it)
Remove all permissions, so it can't be read or written to
CLI method (undo)
Re-enable "reopen all apps" after login