Are you experiencing panics or problems with USB-C external displays?

Many users report issues with second or external displays, which can have problems with sleep, and sometimes when woken lead to a kernel panic. This short article suggests some possible workarounds and remedies which you can try should you have such problems with a display connected to a USB-C/Thunderbolt port on your Mac.

Check and update your Mac’s firmware

Ensure that you’re running a fully updated copy of the major version of macOS which you’ve chosen, and that its firmware is up to date for that version too. Firmware versions are given here:

Each of those articles contains detailed instructions for use, and other helpful information.

Older versions of firmware, particularly when used with newer kernels and extensions, can be unstable. If you’re getting kernel panics which keep recurring, try resetting your SMC and NVRAM. In the most stubborn cases, it may help to perform a clean re-install of macOS.

Ensure your cable/adapter is good

Digital display cables and adaptors are quite sophisticated, and aren’t all equal. This is particularly true for USB-C and Thunderbolt, which incorporate chips and aren’t always built in compliance with standards. Some early versions of Raspberry Pi 4 had hardware problems as a result of their USB-C ports not being constructed correctly, for example.

Shut down before disconnect

When you experience problems with external displays, ensure that you shut your Mac down before disconnecting it from the display. If your Mac’s still running when you unplug the cable, then kernel problems can persist.

Try keeping the display awake

Panics and other problems often occur when the external display goes to sleep, or the Mac tries to wake it from sleep. These can often be worked around by temporarily preventing displays from sleep.

Rather than fiddling with the Energy Saver settings all the time, it’s easier to use the bundled command tool caffeinate to do this. caffeinate is a wonderful way to prevent certain types of sleep on a temporary basis, as it doesn’t mess around with pmset controls, but creates assertions which will prevent a specific type of sleep. In this case, you want to prevent displays from sleeping, using the command
caffeinate -d
as soon as the display is connected. Then, to disconnect the external display, shut your Mac down first, and unplug the cable. When your Mac next starts up, display sleep behaviour will return to whatever is set in the Energy Saver pane.

If you’d rather not use Terminal, Amphetamine and Lungo in the App Store will handle this from the menu bar. Sadly, the old freeware Caffeine seems to have been abandoned now, and is unlikely to work with recent versions of macOS.

caffeinate

This tool, and its App Store wrapper apps Amphetamine and Lungo, has many other uses, according to the type of sleep you wish to prevent. Its options include:

  • -d to prevent display sleep
  • -i to prevent system sleep
  • -m to prevent disk sleep
  • -s to prevent system sleep only when on AC/mains power
  • -u to declare that the user is active, specifying with -t the period in seconds for this to last.

caffeinate works by forking a process in which ‘make’ is executed. To de-caffeinate, kill that forked process, or restart.

Thanks to Maxwell @mxswd for pointing out some of these tips.