MacBook的休眠机制
休眠与下面两个因素有关
- 进入休眠的等待时间
- 是否有防止睡眠的程序运行
如何查看休眠的等待时间
命令行方式
其中的sleep就是等待进入睡眠的分钟数
pmset -g
System-wide power settings:
SleepDisabled 0
VACTDisabled 0
Currently in use:
lidwake 1
autopoweroff 1
lowpowermode 0
standbydelayhigh 900
autopoweroffdelay 259200
proximitywake 1
standby 1
standbydelaylow 600
ttyskeepawake 1
hibernatemode 3
powernap 0
gpuswitch 2
hibernatefile /var/vm/sleepimage
highstandbythreshold 50
displaysleep 2
womp 0
networkoversleep 0
sleep 5
tcpkeepalive 1
halfdim 1
acwake 0
disksleep 10
界面查看
系统信息->电源 中查看, 其中的系统睡眠定时器

如何查看是否有防止睡眠的程序运行
界面查看
其中的防止睡眠为是的进程, 就会阻止休眠, 常见的程序有音乐, 图书, 索引程序等, 需要看情况停止掉

命令行查看
输入
pmset -g
如下显示, 如果有prevented的进程, 就休眠不了
sleep 5 (sleep prevented by runningboardd)
输入
pmset -g assertions
显示
2023-05-24 16:21:15 +0800
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 520(WindowServer): [0x0000311800099780] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle serviceID:100003fd2 service:AppleUserHIDEventService product:USB Gaming Keyboard eventType:3"
Timeout will fire in 120 secs Action=TimeoutActionRelease
pid 179(runningboardd): [0x0000342b00019951] 00:00:00 PreventUserIdleSystemSleep named: "app<application.com.tencent.wwmapp.22473637.22473642.2F0D80C6-FE4C-4AE7-9E00-A2EA47947703(501)>179-5862-13981:com.apple.CFNetwork.StorageDB"
Created for PID: 5862.
pid 179(runningboardd): [0x0000325f00019902] 00:07:40 PreventUserIdleSystemSleep named: "app<application.com.apple.iBooksX.1152921500311880360.1152921500311880904(501)>179-919-12078:Shared Background Assertion 117 for com.apple.iBooksX(FinishTask)"
Created for PID: 919.
Kernel Assertions: 0x4=USB
id=532 level=255 0x4=USB creat=2023/5/24 15:36 description=com.apple.usb.externaldevice.14100000 owner=IOUSBHostDevice
id=534 level=255 0x4=USB creat=2023/5/24 15:23 description=com.apple.usb.externaldevice.14110000 owner=USB Gaming Keyboard
id=536 level=255 0x4=USB creat=2023/5/24 15:24 description=com.apple.usb.externaldevice.14120000 owner=USB Receiver
Idle sleep preventers: IODisplayWrangler