Fixing USB disconnects on sleep on macOS

How I avoided having to unplug and replug my keyboard each time my Mac went to sleep

Most times when my Mac went to sleep, my Anker USB-C dock would stop working, meaning any peripheral attached to it would also stop working. The “fix” was to disconnect and reconnect. Not a major issue since I only have things like keyboards and mice attached to it, but hardly ideal.

Some searching suggested this was a fairly common problem and nowhere was suggesting specific fixes. A lot of people were blaming macOS because previous versions worked for them.

What worked for me was saying, “Prevent automatic sleeping on power adapter when the display is off”. Which is a fairly wordy setting! It means that when my screen is asleep, don’t put the entire computer to sleep when I’m plugged in.

This setting is found under “Displays » Advanced” in older versions of macOS and “Battery » Options” in newer versions of macOS, including Tahoe 26.3, which I have just re-tested this on.

Prevent auto sleep on macOS
Where to find setting in newer versions of macOS

I think what was happening was my computer would go to sleep, but my Anker hub wasn’t smart enough to reconnect to the Mac when it woke up. I believe there are some USB devices that can work out when to turn on and off, I don’t really understand that enough to comment.

Hopefully, this helps you if you find yourself in a similar situation.

2026 Update

It has been over three years since I first recommended this fix, and I’m happy to report I haven’t had a single issue with it since applying this setting. I was worried there would be an issue with my computer never fully sleeping, but I have nothing negative to report.

    Recent posts View all

    Rails

    Dealing with multiple languages with inflections

    How to have your site deal with multiple languages in inflections

    Threat Intelligence JavaScript

    Threat Intelligence Issue 5

    Issue 5 of our Threat Intelligence information