Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save materemias/e6d890cde7639c49d6887a4d6bea702d to your computer and use it in GitHub Desktop.
Save materemias/e6d890cde7639c49d6887a4d6bea702d to your computer and use it in GitHub Desktop.
Fix standby battery drain Macbook Pro - Big Sur

Fixing standby battery drain issue Macbook Pro - Big Sur

1. Reboot into recovery mode

  1. Disable FileVault (System Preferences -> Security & Privacy -> FileVault -> Turn Off Filevault)
  2. Boot to recovery mode by holding Command + R during boot

2. Preparation

  1. Open Terminal
  2. Run csrutil authenticated-root disable to disable signature validation on the bootable snapshots
  3. Run ioreg -l | grep board-id to get your board ID and write it down.
  4. Find your root mount's device - run diskutil list and search for YourDriveName and note the identifier, eg disk1s2
  5. Run diskutil mount disk1s2 and the drive will be mounted under /Volumes/YourDriveName
  6. Mount disk as writeable using mount -uw /Volumes/YourDriveName
  7. Navigate to /Volumes/YourDriveName/System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/X86PlatformPlugin.kext/Contents/Resources
  8. Change ownership of the files using sudo chmod a+rw *.plist

3. Patching

  1. Look for a file in the current directory that has your board ID (from step 2.3) as the filename (*.plist file)
  2. Open the file using vi or vim and then change these key values with a text editor so that they match these settings:
<key>TCPKeepAliveDuringSleep</key>
<false/>
...
<key>NotificationWake</key>
<false/>
<key>DNDWhileDisplaySleeps</key>
<true/>
  1. Save changes and exit the editor

4. Create new bootable snapshot for SSV

  1. Run the commands below (choice) to create and bless a new bootable snapshot
  • sudo bless --folder /Volumes/YourDiskName/System/Library/CoreServices --bootefi --create-snapshot

or

  • Create snapshot

    /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_systemsnapshot -s "BatteryFix" -v /Volumes/YourDiskName

  • Mark the snapshot as bootable

    /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_systemsnapshot -r "BatteryFix" -v /Volumes/YourDiskName

  1. Verify that the snapshot has been made using diskutil apfs listSnapshots disk1s2 (using the disk from step 2.4). Results should like something like
Snapshots for disk1s2 (2 found)
|
+-- FEE397E8-F5C5-42E5-8372-BD5BDDFF903D
|   Name:        com.apple.os.update-779BDF1556C6F688504E24FB29C75AFFABFCB91E701806FFFF35235E19914F1E
|   XID:         3678974
|   Purgeable:   No
|   NOTE:        This snapshot limits the minimum size of APFS Container disk1
|
+-- 1357DDAF-0CBC-4909-94D5-65F334DEAEA4
    Name:        com.apple.bless.209A7AB5-0806-4C92-8043-F9C6882A838D
    XID:         9223372036858584732
    Purgeable:   Yes

5. Reboot

  1. Reboot the Macbook, this might take a while
  2. Verify it's running of the snapshot by opening Disk Utility and click YourDriveName. Under System Snapshot Mounted it should show the latest snapshot from step 4.2

Reboot can take a while, don't worry. If the system hasn't booted after 10 minutes or so you can "activate" the original snapshot by running /System/Library/Filesystems/apfs.fs/Contents/Resources/apfs_systemsnapshot -r "First_Guid_From_Snapshotlist" -v /Volumes/YourDiskName

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment