MacBook 提升电池效率的一些设置

虽然说Macbook电池能够撑爆很长时间,但是,对于电池来说,永远不够的。 下面一些设置,可减少合起盖子的时候的耗电。当然,你的其他部分功能会缺失。

查看电源管理设置

使用 pmset 命令可以查看系统电源的管理设置

$ pmset -g
Active Profiles:
Battery Power       1
AC Power        2*
Currently in use:
 standbydelay         4200
 standby              1
 womp                 1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 darkwakes            1
 networkoversleep     0
 disksleep            10
 sleep                10 (sleep prevented by AddressBookSour)
 autopoweroffdelay    14400
 hibernatemode        3
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         10
 acwake               0
 lidwake              1

停用 AddressBookSour

看到这句 (sleep prevented by AddressBookSour), 于是怀疑会不会是 AddressBook 应用引起的系统无法进入休眠状态.

查找了一些关于 AddressBook 的一些资料, 这其实是 Mac OS 用来同步联系人信息的工具, 同时因为这个工具出现很多系统问题.

这个工具对我来说也没有任何意义, 将其停用完事.

/System/Library/Frameworks/ 目录下进入 AddressBook.framework, 然后删除 Helpers 目录下的 AddressBookSourceSync.app 即可. (不要将整个 AddressBook.framework 删除, 不然会导致 Finder 等应用无法正常工作)

$ cd /System/Library/Frameworks/AddressBook.framework/Helpers
$ sudo mv AddressBookSourceSync.app AddressBookSourceSync.bak

上面操作过于不友好,调整为以下方法:

launchctl unload -w /System/Library/LaunchAgents/com.apple.AddressBook.SourceSync.plist
#如果你后悔了,可用这样操作
#launchctl load -w /System/Library/LaunchAgents/com.apple.AddressBook.SourceSync.plist

现在执行 pmset -g 命令 (sleep prevented by AddressBookSour) 这句提示已经消失了:

$ pmset -g
Active Profiles:
Battery Power       1
AC Power        2*
Currently in use:
 standbydelay         4200
 standby              1
 womp                 1
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 darkwakes            1
 networkoversleep     0
 disksleep            10
 sleep                10
 autopoweroffdelay    14400
 hibernatemode        3
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         10
 acwake               0
 lidwake              1

修改休眠模式

停用 AddressBookSour 后, 发现合盖后系统还是无法立即进入休眠状态, 问题就出在休眠模式(hibermode)上.

$ man pmset
We do not recommend modifying hibernation settings.
Any changes you make are not supported.
If you choose to do so anyway, we recommend using one of these three settings.
For your sake and mine, please don't use anything other 0, 3, or 25.

hibernatemode = 0 (binary 0000) by default on supported desktops.
The system will not back memory up to persistent storage.
The system must wake from the contents of memory;
the system will lose context on power loss.
This is, historically, plain old sleep.

hibernatemode = 3 (binary 0011) by default on supported portables.
The system will store a copy of memory to persistent storage (the disk),
and will power memory during sleep.
The system will wake from memory,
unless a power loss forces it to restore from hibernate image.

hibernatemode = 25 (binary 0001 1001) is only settable via pmset.
The system will store a copy of memory to persistent storage (the disk),
and will remove power to memory.
The system will restore from disk image.
If you want "hibernation" - slower sleeps, slower wakes, and better battery life,
you should use this setting.

设置系统 hibernatemode:

$ sudo pmset -a hibernatemode 25 # setting hibernatemode to 25

这样合盖后系统就能立即进入休眠状态了.

修改Standby的时间

缩短上面的 standbydelay 时间,终端输入命令: sudo pmset -a standbydelay [你希望的秒数]。我改成了一个小时,因为我如果合上盖子之后一个多小时没有打开,我一般都是有事出去了,所以电脑两个小时就可以休眠了。

via: http://blog.fourcels.me/2015/01/05/mac-os-hibernate.html
https://www.v2ex.com/t/280420#reply13