Battery Drain Issue in macOS in sleep

  • Yubikeys cause a known issue where they wake up macOS laptops from sleep causing battery drain. This can be avoided by tweaking power via pmset. Switch hibernatemode to “hibernate” (25) and then set a quick transition for sleep -> hibernate. For example:
sudo pmset -a hibernatemode 25
sudo pmset -a standbydelay 15

With this, the laptop will go into hibernation 15 seconds after sleep and it will also use “Hibernation” where memory is written to disk and then power is removed from memory. The laptop will boot slower coming out of sleep but battery life will be conserved with the Yubikey.

Links to this note