macOS closes all my applications when I lock my screen

When I lock my screen with ControlCommandQ and return after more than 10 minutes, macOS has closed all my open apps and tries to restore them, which often leaves my applications in half restored states.

This did not happen before. Also a few times I have been logged out randomly, causing the same issue.

I'm using macOS High Sierra 10.13.6.

Security and Privacy settings:

  • Advanced, Log out after x minutes is not checked.

Any guesses for why this happens?


Solution 1:

Open System Preferences from the Apple menu in the top-left corner. Open the "Security & Privacy" preference pane. Click on the "Advanced..." button in the bottom-right corner. You may need to unlock the pane using the padlock icon in the bottom-left corner.

I think you'll find "Log out after XX minutes of inactivity" ticked. Untick it.

Reference: https://apple.stackexchange.com/a/140077

Solution 2:

My first guess is that your "windowserver" process had crashed. It provides support for login/logout, user-switching, and animation effects. If it crashes, every application you have open will also be terminated.

Check for "loginwindow" or "windowserver" errors in your system log, or go to /Library/Logs/DiagnosticReports and look for crash reports that contain the keyword "window".

If it's not the fault, you may have to contact Apple. You may reach them at support.apple.com/contact or bugreport.apple.com.