Problem
My MacBook Pro seems to have trouble sleeping when closed. I noticed it because it's hot in the mornings, while the battery is nearly drained. It doesn't happen all the time, and, unfortunately, I don't know how to reproduce this behaviour on purpose.
Sometimes I use Caffeine, an app which makes sure Mac won't go to sleep. I used it with my old MacBook 12' and it worked well with Caffeine activated (it was sleeping tight). This one though, I can't leave it in my backpack on (alleged) sleep since I'm afraid of damaging it from excessive heat. However this app seems to be unrelated to be problem, since it occurred without the application as well.
Question
What wakes my Mac and how can I be sure that it'll sleep for the whole night?
Additional information
MacBook Pro (13-inch, 2018, Four Thunderbolt 3 Ports), Mojave 10.14.4, 2,3 GHz Intel Core i5, 16 GB 2133 MHz LPDDR3
I did some research, tried to investigate it on my own, but I'm clueless with this output:
$ log show --style syslog # excerpt - the first line is repeated many times during the night
2019-05-21 00:18:57.630795+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630796+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630797+0200 localhost apsd[74]: <private>: Not choosing red list for topic com.apple.Notes because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630798+0200 localhost apsd[74]: <private>: Not choosing red list for topic com.apple.Notes because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630799+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630799+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630800+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630801+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.630965+0200 localhost apsd[74]: (Security) Created Activity ID: 0xe3c85, Description: SecItemCopyMatching
2019-05-21 00:18:57.631108+0200 localhost apsd[74]: (Security) Created Activity ID: 0xe3c86, Description: SecItemCopyMatching
2019-05-21 00:18:57.631112+0200 localhost apsd[74]: (Security) Created Activity ID: 0xe3c87, Parent ID: 0x80000000000e3c86, Description: SecItemCopyMatching_ios
2019-05-21 00:18:57.631166+0200 localhost apsd[74]: (Security) [com.apple.securityd:SecCritical] Failed to talk to secd after 4 attempts.
2019-05-21 00:18:57.631190+0200 localhost apsd[74]: (Security) Created Activity ID: 0xe3c88, Description: SecItemCopyMatching
2019-05-21 00:18:57.631292+0200 localhost apsd[74]: Looking up connection on peer: 5ab15c70 found <private>
2019-05-21 00:18:57.631495+0200 localhost apsd[74]: successful entitlement check 'com.apple.private.push-to-wake' for 263
2019-05-21 00:18:57.631508+0200 localhost apsd[74]: [com.apple.apsd:connectionServer] <private>: connection set push wake topics from <private> to <private>
2019-05-21 00:18:57.631586+0200 localhost apsd[74]: <private>: Filter will potentially be changed by <private>
2019-05-21 00:18:57.631595+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631596+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631598+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631599+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631600+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631601+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631603+0200 localhost apsd[74]: <private>: Not choosing red list for topic com.apple.private.ids because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631604+0200 localhost apsd[74]: <private>: Not choosing red list for topic com.apple.private.ids because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631606+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631606+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
2019-05-21 00:18:57.631608+0200 localhost apsd[74]: <private>: Not choosing red list for topic <private> because dark wake enabled and in full into dark wake
...
$ pmset -g assertions
Assertion status system-wide:
BackgroundTask 0
ApplePushServiceTask 0
UserIsActive 1
PreventUserIdleDisplaySleep 0
PreventSystemSleep 0
ExternalMedia 0
PreventUserIdleSystemSleep 1
NetworkClientActive 0
Listed by owning process:
pid 286(sharingd): [0x000142480001a7f2] 00:00:38 PreventUserIdleSystemSleep named: "Handoff"
pid 97(hidd): [0x000135310009a2c8] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4295051175.3"
Timeout will fire in 600 secs Action=TimeoutActionRelease
Kernel Assertions: 0x104=USB,MAGICWAKE
id=508 level=255 0x100=MAGICWAKE mod=21/05/2019, 15:48 description=en0 owner=en0
id=1165 level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.01100000 owner=USB3.0 Hub
id=1167 level=255 0x4=USB mod=01/01/1970, 01:00 description=com.apple.usb.externaldevice.14200000 owner=USB2.0 Hub
Idle sleep preventers: IODisplayWrangler
$ pmset -g
System-wide power settings:
Currently in use:
standbydelaylow 10800
standby 1
womp 1
halfdim 1
hibernatefile /var/vm/sleepimage
proximitywake 1
powernap 1
gpuswitch 2
networkoversleep 0
disksleep 10
standbydelayhigh 86400
sleep 1
hibernatemode 3
ttyskeepawake 1
displaysleep 10
tcpkeepalive 1
highstandbythreshold 50
acwake 0
lidwake 1
Update
The problem occurred once again, so here are some fresh logs.
pmset -g assertions SIG(127) ↵ 676 08:22:09
2019-05-31 08:22:11 +0200
Assertion status system-wide:
BackgroundTask 0
ApplePushServiceTask 0
UserIsActive 1
PreventUserIdleDisplaySleep 0
PreventSystemSleep 0
ExternalMedia 0
PreventUserIdleSystemSleep 1
NetworkClientActive 0
Listed by owning process:
pid 339(sharingd): [0x0000f2370001927c] 00:04:15 PreventUserIdleSystemSleep named: "Handoff"
pid 97(hidd): [0x0000f1db00099242] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle.4295045456.3"
Timeout will fire in 120 secs Action=TimeoutActionRelease
No kernel assertions.
Idle sleep preventers: IODisplayWrangler
pmset -g ✔ 677 08:22:11
System-wide power settings:
Currently in use:
standbydelaylow 10800
standby 1
halfdim 1
hibernatefile /var/vm/sleepimage
proximitywake 0
gpuswitch 2
powernap 0
disksleep 10
standbydelayhigh 86400
sleep 1 (sleep prevented by sharingd, useractivityd)
hibernatemode 3
ttyskeepawake 1
displaysleep 2
tcpkeepalive 1
highstandbythreshold 50
acwake 0
lidwake 1
log show --style syslog --start '2019-05-31 00:00:00' | wc -l
1562157
log show --style syslog --start '2019-05-31 00:00:00' --end '2019-05-31 07:00:00' | grep 'PMRD'
2019-05-31 01:33:46.043541+0200 localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:34:16.800941+0200 localhost kernel[0]: PMRD: System Wake
2019-05-31 01:34:31.060901+0200 localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:35:01.751271+0200 localhost kernel[0]: PMRD: System Wake
2019-05-31 01:35:16.009550+0200 localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:35:46.809967+0200 localhost kernel[0]: PMRD: System Wake
2019-05-31 01:36:01.203380+0200 localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:36:31.761539+0200 localhost kernel[0]: PMRD: System Wake
2019-05-31 01:36:46.031087+0200 localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:37:16.723436+0200 localhost kernel[0]: PMRD: System Wake
2019-05-31 01:37:32.456445+0200 localhost kernel[0]: PMRD: System Sleep
2019-05-31 01:38:02.800643+0200 localhost kernel[0]: PMRD: System Wake
2019-05-31 01:38:58.519978+0200 localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:39:24.167452+0200 localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:40:01.799306+0200 localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:40:18.142921+0200 localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:40:55.616962+0200 localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:41:11.129164+0200 localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:41:48.567301+0200 localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:42:04.611552+0200 localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:42:40.632701+0200 localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:42:56.262092+0200 localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:43:33.703435+0200 localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:43:49.242617+0200 localhost kernel[0]: PMRD: System SafeSleep
2019-05-31 01:44:26.598513+0200 localhost kernel[0]: PMRD: System SafeSleep Wake
2019-05-31 01:44:42.316342+0200 localhost kernel[0]: PMRD: System SafeSleep
log show --style syslog --start '2019-05-31 01:38:02' --end '2019-05-31 01:38:03' # excerpt - maybe this?
2019-05-31 01:38:02.900304+0200 localhost callservicesd[278]: [com.apple.calls.callservicesd:Default] Updating nearby device routes using devices: <private>
2019-05-31 01:38:02.900347+0200 localhost callservicesd[278]: [com.apple.calls.callservicesd:Default] Not adding any nearby devices because currentCallsSupportNearbyDevices=<private>, supportsPrimaryCalling=<private>, and hasRelayiCloudAccount=<private>
2019-05-31 01:38:02.900433+0200 localhost airportd[180]: ERROR: sharingd (339) is not entitled for com.apple.wifi.join_history, will not allow request
2019-05-31 01:38:02.900949+0200 localhost sharingd[339]: (CoreUtils) [com.apple.CoreUtils:CUWiFiManager] SysMon: WiFi state changed: Connected -> Connected, 0x1 < Unsecured > "Warto było szaleć tak? 5g"
2019-05-31 01:38:02.900952+0200 localhost sharingd[339]: (CoreUtils) [com.apple.CoreUtils:CUSystemMonitor] WiFi state changed: Connected -> Connected, 0x1 < Unsecured >
2019-05-31 01:38:02.905415+0200 localhost kernel[0]: (AppleOnboardSerial) programUART() will skip programRTS()
2019-05-31 01:38:02.934141+0200 localhost kernel[0]: (AppleOnboardSerial) programUART() will skip programRTS()
2019-05-31 01:38:02.934934+0200 localhost kernel[0]: (corecapture) 054632.527762 wlan0.A[5294] powerOn@201:SMC key MSSP=05
2019-05-31 01:38:02.942451+0200 localhost kernel[0]: (corecapture) 054632.535275 wlan0.A[5295] handleDataPacket@9908: Wake up packet received: Data
2019-05-31 01:38:02.942534+0200 localhost kernel[0]: (corecapture) 054632.535362 wlan0.A[5297] Wake Packet Analysis: TCP/IP Packet from 17:252:76:29 with ports 443 --> 62667
2019-05-31 01:38:02.949716+0200 localhost kernel[0]: (corecapture) 054632.542542 wlan0.A[5299] powerOn@22517: Tearing down WoW mode
2019-05-31 01:38:02.952471+0200 localhost kernel[0]: (corecapture) 054632.545297 wlan0.A[5300] handleTCPKeepAliveStatusAsyncCallBack@927:TKO Socket Id 0, Status: Ack Number invalid
2019-05-31 01:38:02.953288+0200 localhost kernel[0]: (corecapture) 054632.546114 wlan0.A[5301] setTCPAliveOffloadEnable@539:TCP Keep Alive Offload: Disabled
2019-05-31 01:38:02.954166+0200 localhost kernel[0]: (corecapture) 054632.546991 wlan0.A[5302] unConfigureKeepAlives@808:UnConfigured Keep Alive ID = 1
2019-05-31 01:38:02.954994+0200 localhost kernel[0]: (corecapture) 054632.547820 wlan0.A[5303] unConfigureKeepAlives@808:UnConfigured Keep Alive ID = 2
2019-05-31 01:38:02.955006+0200 localhost kernel[0]: (corecapture) 054632.547836 wlan0.A[5304] configureEnterpriseAssociatedSleepExit@1193:WNM is Not Supported
2019-05-31 01:38:02.960891+0200 localhost kernel[0]: (AppleOnboardSerial) programUART() will skip programRTS()
2019-05-31 01:38:02.967791+0200 localhost coreaudiod[137]: (BluetoothAudioPlugIn) [com.apple.bluetooth:bluetoothaudiod] hostController general interest notification e0020002
2019-05-31 01:38:02.967829+0200 localhost UserEventAgent[246]: (BluetoothUserAgent-Plugin) [com.apple.bluetooth:User Agent] [BTUserEventAgentController hostControllerPoweredOn] on = 0 off = 100657
2019-05-31 01:38:02.967831+0200 localhost UserEventAgent[246]: (BluetoothUserAgent-Plugin) [com.apple.bluetooth:User Agent] [BTUserEventAgentController messageTracerEventDriven] hostControllerPoweredOn
2019-05-31 01:38:02.967832+0200 localhost bluetoothd[96]: (IOBluetooth) [com.apple.bluetooth:bluetoothd] INIT -- Host Controller 0x7fe094908050 is powered ON
2019-05-31 01:38:02.967832+0200 localhost UserEventAgent[246]: (BluetoothUserAgent-Plugin) [com.apple.bluetooth:User Agent] [BTUserEventAgentController messageTracerEventDriven]
2019-05-31 01:38:02.967893+0200 localhost bluetoothd[96]: (IOBluetooth) [com.apple.bluetooth:bluetoothd] INIT -- Ignoring poweredOn since we have already setup everything
sudo log show --style syslog --start '2019-05-31 01:37:00' --end '2019-05-31 01:39:00' | grep 'apsd'
powerOn@201:SMC key MSSP=05 -- handleDataPacket@9908: Wake up packet received: Data -- Wake Packet Analysis: TCP/IP Packet from 17:252:76:29 with ports 443 --> 62667