Mac盒盖掉电严重

sleep prevented by sharingd

Mac book pro 盒盖后第二天掉电 40%,而且发烫,原因是有进程阻止休眠。

通过 pmset -g 可以看到阻止的程序是 sharingd

$ pmset -g
System-wide power settings:
 SleepDisabled		0
 DestroyFVKeyOnStandby		0
Currently in use:
 standbydelaylow      10800
 standby              1
 womp                 1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 powernap             1
 gpuswitch            2
 networkoversleep     0
 disksleep            10
 standbydelayhigh     86400
 sleep                1 (sleep prevented by sharingd)
 autopoweroffdelay    28800
 hibernatemode        25
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         10
 highstandbythreshold 50
 acwake               0
 lidwake              1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

通过 pmset -g assertions 发现 sharingd 背后的程序是 接力。也就是你打开 iPhone QQ、微信等程序的时候,可能会提示剪切板来自 macboook-xxx,相当于一个云剪切板,这个功能比较鸡肋,可以去掉。

$ pmset -g assertions
2021-02-08 20:26:49 +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 505(sharingd): [0x0003f05a0001882d] 00:01:09 PreventUserIdleSystemSleep named: "Handoff"
   pid 184(hidd): [0x0003d3960009a781] 00:00:00 UserIsActive named: "com.apple.iohideventsystem.queue.tickle serviceID:10003f477 name:AppleHIDKeyboardEve product:USB Keyboard eventType:3"
	Timeout will fire in 600 secs Action=TimeoutActionRelease
   pid 499(useractivityd): [0x0003f09e00018836] 00:00:00 PreventUserIdleSystemSleep named: "BTLEAdvertisement"
	Timeout will fire in 59 secs Action=TimeoutActionTurnOff
Kernel Assertions: 0x10c=USB,BT-HID,MAGICWAKE
   id=504  level=255 0x100=MAGICWAKE mod=2021/2/8 20:35 description=llw0 owner=IOSkywalkNetworkBSDClient
   id=505  level=255 0x100=MAGICWAKE mod=2021/2/8 20:25 description=en0 owner=en0
   id=610  level=255 0x4=USB mod=1970/1/1 08:00 description=com.apple.usb.externaldevice.14100000 owner=USB Keyboard
   id=611  level=255 0x8=BT-HID mod=1970/1/1 08:00 description=com.apple.driver.IOBluetoothHIDDriver owner=AppleHSBluetoothDevice
Idle sleep preventers: IODisplayWrangler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

【偏好设置】 -> 【通用】 ,取消 允许在这台Mac和icloud设备之间使用接力-w668

接着运行 pmmset -g 已经找不到阻止睡眠的程序了。

$ pmset -g
System-wide power settings:
 SleepDisabled		0
 DestroyFVKeyOnStandby		0
Currently in use:
 standbydelaylow      10800
 standby              1
 womp                 1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 powernap             1
 gpuswitch            2
 networkoversleep     0
 disksleep            10
 standbydelayhigh     86400
 sleep                1
 autopoweroffdelay    28800
 hibernatemode        25
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         10
 highstandbythreshold 50
 acwake               0
 lidwake              1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

另外建议盒盖前,把蓝牙、WiFi 都关掉。

sleep prevented by AddressBookSourceSync

$ pmset -g
System-wide power settings:
 DestroyFVKeyOnStandby		0
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 (sleep prevented by AddressBookSourceSync)
 hibernatemode        3
 ttyskeepawake        1
 displaysleep         10
 tcpkeepalive         1
 highstandbythreshold 50
 acwake               0
 lidwake              1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

偏好设置 -> Apple ID -> iCloud -> 取消勾选 通讯录 -w681

不过,等 macOS 升级后,可能又不行了,需要重新登录 iCloud,我嫌麻烦,直接把 AddressBook 目录干掉。

$ cd ~/Library/Application\ Support/
$ sudo mv AddressBook/ AddressBook.bak
$ mkdir AddressBook
$ sudo chown root:wheel AddressBook
1
2
3
4

除了把之前的干掉外,你也看到创建了一个空目录,而且修改目录权限,这样系统就不能再创建一个 AddressBook 目录 或往 AddressBook 目录中同步文件了。

整个世界都清净了。

reference