MacOS – Plugging in external monitor “logs out” (crashes?) user session

crashdisplaymacbook promacos

When plugging a second external monitor, macOS Sierra "logs out" (crashes?) user session. I get presented with the login window. No error message.

It's not just "show login window", because all apps load anew after logging in (which takes a very loooong time, killing my productivity).

macOS Sierra 10.12.3 (16D32).

DisplayPort external monitors.

MacBook Pro Retina Late 2013, 13".

I don't recall this happening on El Capitan. I upgraded to sierra yesterday.

There is no error message, like "was not closed normally", therefore I believe this is not a duplicate of After Installing El Capitan I Will be Logged Out Frequently (and mine is about Sierra).

I do not see anything interesting in Console logs (although maybe someone could point me to where to look).

What could be causing this?
How to prevent this from happening?

What diagnostics can I do?

Edit: Some other considerations:

  1. I was fiddling with SwitchResX for custom display modes (HiDPI on external displays). As described in: 1280×720 HiDPI resolution for 2560×1440 monitor

  2. there is no corrupted graphics like in the other question(s)

Edit 2: The main monitor is: LG 27UD88-W Monitor 27" UHD 4K USB-C USB 3.0, connected via DisplayPort

Edit 3: The problem also happens when I unplug the monitor (or switch the monitor, in its own menu, to use another input cable)

Edit 4: Also posted on Apple support: https://discussions.apple.com/message/31686056

Edit 5: Also uninstalled SwitchResX (via their menu). Problem still happens!

Best Answer

If the issue occurred after an update you may have a potential software issue. I understand you have tried a lot of troubleshooting in the comments but I listed the steps that I would follow below.

  1. Make sure you backup all your files first before continuing troubleshooting: https://support.apple.com/en-us/HT201250

  2. Follow this support article from Apple regarding video issues using external displays: https://support.apple.com/en-us/HT201177

  3. As @Stefan suggested, Try reseting SMC. Shut the machine off. Press Shift-Control-Option on the left side of the built-in keyboard, then press the power button at the same time. Hold these keys and the power button for 10 seconds. Release keys. Power Machine on. SMC: https://support.apple.com/en-us/HT201295

  4. Try reseting NVRAM: Shut down your Mac, then turn it on and immediately press and hold these four keys together: Option, Command, P, and R. You can release the keys after about 20 seconds, during which your Mac might appear to restart. On Mac computers that play a startup sound, you can release the keys after the second startup sound. NVRAM: https://support.apple.com/en-us/HT204063

  5. Try booting in Safe Mode as @Allan suggested and see if you can reproduce the issue. Restart machine and hold down the shift key till you see login screen. Safe Mode: https://support.apple.com/en-us/HT201262

  6. Run diagnostics on your device locally and check for potential hardware issues. Restart machine and hold the "D" key till prompted to run diagnostics. Even if you machine passes the diagnostics, you may still have a hardware issue. note the Apple Store Genius Bar can run deeper tests on your machine if you schedule an appointment. Diagnostics Mode: https://support.apple.com/en-us/HT202731

  7. If hardware diagnostics passes, you can use Recovery Mode to reinstall the operating system or erase the machine and do a clean install. In recovery mode, if you choose to reinstall the macOS it will preserve the files on your system. You can also perform a clean install from macOS by reformatting the storage drive before installing the macOS. Recovery Mode: https://support.apple.com/en-us/HT204904

  8. You can try updating to the latest macOS. I was having issues using display port and external monitors, updating to High Sierra resolved the issue for me. Update the software on Mac: https://support.apple.com/en-us/HT201541

At the end of the day, the issue you are having is either software or hardware related. By performing a clean install, we eliminate any potential software issues, not factoring in bad display driver code (typically these drivers get updated when you run system updates or upgrade macOS). If the issues continue to happen you may have a hardware issue of some sort either with your MacBook Pro, the displays, or the cables.