Dr. Duh’s yuibkey guide is essential reading on this topic and how to properly setup GnuPG (gpg) and ssh
Battery Drain Issue in macOS in sleephacks
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.