Power Management 101

Now that your hackintosh is up and running, you can take on the task of setting up Power management. If you're unsure on what to do, this in-depth guide will cover the ins and outs of how and what you can do. This guide assumes you have installed macOS and it's stable during use.

To understand what the differences are, I’ll explain:

  • Shutdown: macOS terminates the session and powers the hardware off. You must press the power button to start the boot process from a fresh session.
  • Hibernate: macOS writes the session contents from RAM to the disk and clears RAM. The hardware enters a standby state and can be started with a key press or mouse click where it fast boots into the last used OS. The session is loaded from the disk.
  • Hybrid: macOS writes the session contents from RAM to the disk while keeping the contents of RAM. The hardware enters a standby state and can be started with a key press or mouse click where it fast boots into the last used OS. The session is loaded from RAM unless a power loss occurred, then it loads from the disk.
  • Sleep: macOS keeps the session in RAM and does not write to the disk. The hardware enters a standby state and can be started with a key press or mouse click where it fast boots into the last used OS. The session is loaded from RAM unless a power loss occurred, then a fresh session is started.

For the following you'll be using Terminal. There is no GUI for managing or debugging advanced power settings. You'll also need sudo su or as it's known, Root / Admin privileges to make changes. The most important commands you'll be using are:

  • pmset -g assertions – Quickly shows power state preventers.
  • pmset -g log – Fully details power state from the log.

You'll need to add the boot flag darkwake=0 to your config before you begin. Note that using values of yes or no are invalid. They must be numerical. A minimum of 0 and a maximum of 10. Then open System Preferences and make the following changes:

  • Energy Saver > Prevent computer from sleep automatically…
    • Tick
  • Energy Saver > Put hard disks to sleep when possible
    • Tick
  • Energy Saver > Wake for network access
    • Untick
  • Energy Saver > Start up automatically after power failure
    • Untick
  • Energy Saver > Enable Power Nap
    • Untick
  • Bluetooth > Advanced > Allow Bluetooth devices to wake…
    • Untick

If you haven't already added CodecCommander to your kexts colder you'll need to do that. It ensures audio isn't broken when waking from sleep. Darkwake will be covered later on. For now, let’s work with the simple part.

At the top of this page, decide which hibernate state you’ll be using. If you concerned about power loss, use 3. I live in an area where power outages annoyingly happen quite often. For peace of mind I use 3.

  • hibernatemode=0 – Default on desktops. This is basically Sleep.
  • hibernatemode=3 – Default on laptops. This is known as Hybrid.
  • hibernatemode=25 – Only available via pmset. This is traditional Hibernate.

After you’ve chosen which one you want to use, you need to change it. But there are multiple places you can apply this change to. pmset allows you to apply settings for each type of power supply. There is −a, −b, −c, −u.

  • -a targets all power sources.
  • -b targets battery power source.
  • -c targets wall charger power source.
  • -u targets UPS power source.

For laptops you’ll be using either -a, -b, or -c. You could if you wanted, target each power source and set hibernatemode. For desktops you’ll use -a or -u. An example of this syntax is what I use.

pmset -a hibernatemode 3

I personally recommend you change it to 3 or 25 on a desktop. If you are using a laptop, it’s already configured but you’re welcome to adjust to your preference.

Sleep will always save your session to RAM. As it’s faster and keeps everything loaded for a quick power on. This is where darkwake comes in, also known as Power Nap. It only works with sleep. This part of the process is troublesome and known to cause problems in various places. An array of errors can prevent sleep from working and in some cases, you get kernel panics. Unfortunately, there is no definitive documentation on what darkwake values do. I have looked many places on the internet and get nowhere. You’ll have to do what everyone else does - Try one until it works. Hardware varies and that’s the only method available. From my reading a majority of users say 8 or 9 seems to work best. I use 8. I have seen a handful of people say they use 1.

Those two commands at the start of this post is what you’ll use to debug sleep. Here are some strings you’ll need to know:

  • Wake from Normal Sleep [CDNVA] due to XDCI XHC/UserActivity Assertion: Using AC (Charge:0%) – This is a normal wake from sleep. On my desktop I woke sleep by pressing the keyboard.
  • Kernel Idle sleep preventers: <reason> – Where <reason> is will be the cause preventing the kernel from entering a sleep state. An ideal reason should be None.
  • Wake reason: <reason> – If your computer suddenly powers back on after entering sleep, looking this string. Where <reason> is the most common are GLAN (internet), XHCI (usb).

For XHCI you should create a USB SSDT and remove any non-essential hardware. This is crucial and something a lot first time users don’t understand. Creating an SSDT may look ‘hard’ but it’s not. If you want power states then you need to complete that if not already done so. Not only does this help there, it also fixes other issues with device connectivity. If the computer wakes from GLAN you should have disabled magic packet / ethernet wake in your BIOS settings. This is already covered in vanilla guides. You should also have it disabled in the OS. And lastly Clover installer has an RC script that will disable Sleep Proxy Client (mDNSResponder) that causes ethernet waking. If you continue to have troubles, I suggest you perform a search of the internet before you ask. Just in case a solution has already been found.

Now that you’re finished and have a functioning sleep you can enable Power Nap and automatically have the computer go to sleep when the display turns off. Optional of course. You can verify your power settings by typing in terminal pmset -g live.

submitted by /u/cbabbx
[link] [comments]