How can I determine which USB device is causing my system to wake from sleep?


I’m desperately trying to figure out how to get my 2019 iMac running macOS Ventura to stay asleep when I put it to sleep. (Each time it wakes up on its own, various lights blink on and hard drives spin up, causing enough light and sound to disturb my sleep.)

I’ve turned off Power Nap, Wi-Fi, Bluetooth, Wake for network access, Wake for Notifications, Keep network connections alive, Stay awake for networking, Stay awake if remote users are active, and a few other settings recommended by the app Sleep Aid.

However, the computer still periodically wakes up, and looking at the output in pmset -g log, I see the following:

2025-05-01 01:42:52 -0400 Assertions            PID 119(powerd) Created InternalPreventSleep "PM configd - Wait for Device enumeration" 00:00:00  id:0x0xd00008623 [System: DeclUser SRPrevSleep kCPU kDisp]
2025-05-01 01:42:52 -0400 DarkWake              DarkWake from Normal Sleep [CDN] : due to XHC2 XHC1/ Using AC (Charge:0%) 45 secs
2025-05-01 01:42:52 -0400 WakeDetails           DriverReason:XHC1 - DriverDetails:
2025-05-01 01:42:52 -0400 HibernateStats        hibmode=3 standbydelaylow=86400 standbydelayhigh=86400                                42
2025-05-01 01:42:52 -0400 WakeTime              WakeTime: 12.265 sec

2025-05-01 07:08:24 -0400 Assertions            PID 119(powerd) Created InternalPreventSleep "com.apple.powermanagement.wakeschedule" 00:00:00  id:0x0xd00009024 [System: DeclUser SRPrevSleep kCPU kDisp]
2025-05-01 07:08:29 -0400 Assertions            PID 119(powerd) TimedOut InternalPreventSleep "com.apple.powermanagement.wakeschedule" 00:00:05  id:0x0xd00009024 [System: DeclUser BGTask SRPrevSleep kCPU kDisp]
2025-05-01 07:08:34 -0400 DarkWake              DarkWake from Normal Sleep [CDN] : due to RTC/Maintenance Using AC (Charge:0%) 0 secs
2025-05-01 07:08:34 -0400 WakeDetails           DriverReason:XHC1 - DriverDetails:
2025-05-01 07:08:34 -0400 HibernateStats        hibmode=3 standbydelaylow=86400 standbydelayhigh=86400                                44
2025-05-01 07:08:34 -0400 WakeTime              WakeTime: 11.226 sec

2025-05-01 09:00:11 -0400 Assertions            PID 119(powerd) TimedOut InternalPreventSleep "com.apple.powermanagement.acwakelinger" 01:51:36  id:0x0xd00009037 [System: DeclUser BGTask SRPrevSleep kCPU kDisp]
2025-05-01 09:00:11 -0400 Assertions            Summary- [System: DeclUser BGTask kDisp] Using AC
2025-05-01 09:00:11 -0400 DarkWake              DarkWake from Normal Sleep [CDN] : due to RTC/Maintenance Using AC (Charge:0%) 0 secs
2025-05-01 09:00:11 -0400 WakeDetails           DriverReason:XHC1 - DriverDetails:
2025-05-01 09:00:11 -0400 HibernateStats        hibmode=3 standbydelaylow=86400 standbydelayhigh=86400                                45
2025-05-01 09:00:11 -0400 WakeTime              WakeTime: 11.221 sec

As near as I can tell, the only real clue from these log entries is XHC1, which points to a USB device connected to that USB controller. This include a variety of different devices, including the built-in FaceTime camera, a keyboard and mouse, and external hard drives.

Is there any way to tell precisely which device it is that triggered the wake up?