Enable true hibernation mode in MacOS

I had meant to have this blog posted a few months back, unfortunately it got stuck on my todo list and never quite made it out, till now.

I decided to go back to a MacBook Pro a few months back, because my Surface Pro 3 was just not capable of running virtual machines. I absolutely love my MacBook Pro 15inch, it runs anything I throw at it, my only gripe is that the memory cannot be upgraded beyond 16GB. I would happily pay more to get 32GB on it.

I had been using a MacBook Pro 13 inch last year, running OS X Mavericks. One of the features I absolutely loved was hibernate to disk. In my view this is much better than sleep mode because my system state is written to disk, instead of being kept in RAM, which needs to be powered on (this is sleep mode). True hibernation (hibernate to disk) is same as the hibernate mode you get with Windows.

To my surprise, when I went to configure hibernate to disk on my new MacBook Pro, my previous steps didn’t work ūüė¶ Ok, I was running MacOS Sierra now, however I expected the process to be the same.

Being the person that rarely gives up (and hibernate to disk was a feature I really really wanted), I started researching on what had happened to it. I managed to find an article from Apple that listed all the supported sleep modes, and oh wait a minute, what is that I see. Aha, Apple calls hibernate to disk Safe sleep, which only happens when your battery is running extremely low. Hmm, now that I know what it is called, and that it can be enabled (at this stage, only when your battery is running extremely low), I started looking for a way to enable it.

In the above article, it did list that there was a Standby Mode which would put MacBooks to deep sleep (aka hibernate to disk) however that happened only after the MacBook was in sleep mode for 3 hours! I was looking for something that will enable it much sooner. Below is the part in the above article referring to deep sleep.

Standby Mode

For Mac computers that start up from an internal SSD, macOS includes a deep sleep mode known as Standby Mode.

Mac computers manufactured in 2013 or later enter standby after being in sleep mode for three hours. Earlier models enter standby after just over an hour of sleep. During standby, the state of your session is saved to flash storage (SSD). Then, the power turns off to some hardware systems such as RAM and USB buses.

Standby extends how long a notebook computer can stay asleep on battery power. A notebook with a fully charged battery can remain in standby for up to thirty days without being plugged in to power.

After some trial and error, I managed to find the setting that will enable my MacBook Pro to go into “deep sleep/safe sleep/hibernate to disk” when it went into sleep mode.

These settings are enabled via the command pmset which is available via Terminal Here is some help with pmset https://www.dssw.co.uk/reference/pmset.html

Start Terminal (Go to Finder/Go/Utilities/Terminal or use Spotlight Search and type Terminal)

To get your current power management settings run pmset -g custom

If for some reason, you mess up your power management settings, you can go to System Preferences/Energy Saver and click on Restore Defaults to get the default power management settings back

EnergySavings_Restore

The settings that enable deep sleep/hibernate to disk is shown below

pmset_hibernatetodisk_settings

 

Use the command sudo pmset -b {option and value} to change any setting that you have which is different from the above values. (-b is to change settings for Battery Power, -c for AC power, -u for ups and -a for everything. I am using -b because I only want to enable hibernate to disk when I am running on battery)

For instance, if you want to change displaysleep for Battery Power from 2 to 5 use the following command

sudo pmset -b displaysleep 5

To check the settings again, run pmset -g custom

To test if hibernate to disk is now enabled, press Command+Option+Power together. Your MacBook should now go to sleep. Give it at least 20 seconds and then press the power button (this is how long I found it took my MacBook Pro to write the contents of RAM to disk. To be sure, you can put your ear to the keyboard, and if you still hear some sound, then it means that your MacBook is still writing to disk. Once everything has been written, it will be absolutely quiet). On waking up, you will see the Apple icon with a progress bar at the bottom. This shows that your MacBook is waking up from deep sleep.

MacOS Wake from Deep Sleep

Hope this helps others who are looking to enable true hibernation on their Macbook

Advertisements

High Battery Drain on Macbook Pro

I recently moved back to a Macbook Pro, and couldn’t be happier. Don’t get me wrong, for what I was using my Microsoft Surface 3 Pro, it did it brilliantly. It is extremely portable and very fast, an amazing device. Unfortunately it is not built to run virtual machines as it grinds to a stop (I know I know, the newer versions of these fantastic machines CAN handle virtual machines, but mine wasn’t that high spec’d).

Previous to my Surface 3 Pro, I was using a Macbook Pro 13 inch (non-retina) and it served me well. However, my current Macbook is a Mabook Pro 15 inch (retina) and with dual Graphics card. It is amazing. With 16GB of RAM, and an i7 processor, it handles anything I throw at it. And the graphics is breath taking, a 4K resolution on a laptop!

However, one of my gripes from day one has been the high battery drain I had been experiencing. Comparing battery life with my colleagues, I found out that while their Macbook Pros would last for at least 5 hours with 100% charge, mine would die in under 3 hours! This either meant that I had been shuffled a defective device by lady luck, or there was some setting I was unaware of. I decided to use the latter of the possible causes and started my investigations.

macOS Sierra (and previous versions) have a native “task manager” called Activity Monitor. This is an amazing utility, as it not only tells you about your CPU and Memory usage, but also shows the impact each application has on your battery.

After viewing the applications under the¬†Energy tab for a few minutes, I didn’t notice anything out of the ordinary, however there was something peculiar happening with the Graphics Card. The¬†High Performance Graphics card was always in use. From what I had previously read, the high performance graphics card on Macbook Pro’s is extremely power hungry, which could explain my high battery drain.

ActivityMonitor_Energy_GraphicsCard

Using Dr. Google I found some articles, which stated that if Automatic graphics switching is disabled under Energy Saver in System Preferences, macOS will use the high performance Graphics Card 100% of the time. I quickly checked my settings and the Automatic graphics switching was unticked!

SystemPreferences_EnergySaver

SystemPreferences_EnergySaver_AutomaticGraphicsCard

I placed a tick beside¬†Automatic graphics switching and then went back to the¬†Activity Monitor utility. This time it showed the¬†Graphics Card as¬†Integrated ūüôā

ActivityMonitor_Energy_Graphics_Integrated

I then proceeded to run my Macbook on battery, keeping an eye on the battery. This time around, the battery didn’t drain as quickly, and the fan noise that I had previously been experiencing (due to the High Performance Graphics card being used) wasn’t present anymore.

I hope this helps others who might be experiencing similar issues with their battery usage. Do note that this is a possible solution for all Macbook Pro’s that have dual Graphics Card but not applicable to those that have only one.