How to get a full work-day battery life on M1 Macbook

I recently switched to a Macbook Air M1 after being a loyal Ubuntu user for the past 15 years. I will be posting about the reasons for switching and the experience and differences between the environments on a different post. In this post, I am going to explain how I manage to get 12+ hours of solid battery life with the proper developer workflow ( coding, taking builds, running services, IDEs, and quintessential meetings/screen sharings of WFH )

The new Macbook Air M1 uses an ARM 64 based SoC ( System On Chip ) developed by Apple. They are so energy efficient and powerful that Apple is claiming 18 hours of battery backup with the Macbook Air for normal day use ( browsing, email, streaming, etc ). I am using this laptop as the daily driver as a full stack developer and am getting a full day ( 9 to 9 ) battery back up. We will see how to achieve the same on any M1 mac.

My Workload

  • IDEs ( IntelliJ for Spring-based enterprise microservices, VSCode for React Native, Sublime for scripting )
  • Services ( Running Mysql, RabbitMQ, MongoDB locally )
  • Postman
  • Utilities ( OpenVPN, RDP, Notion, Calendar, Notes, Mail )
  • Office ( Slack, GMeet )
  • Browser windows ( Google sheets, GMeet, Stack overflow )

Not all of them may be needed in parallel, but someone who is using IntelliJ like a heavyweight IDE could easily comprehend the number of resources it requires.

Optimizations

Even if you have an advertised battery backup of 18+ hours, you will never be able to get a full day back up with the above workload unless you have some optimizations. Following are the major ones that could help to get the same thing.

Use optimized software for M1 chip

This is the most important one to keep in mind. Apple does not require you to have dedicated builds of software based on ARM architecture. Even if the application is Intel-based, it will be translated by a program called Rosetta 2 that allows it to run under the M1 chip. But this translation has some cost and also the program does not use the efficient use of the M1 chip architecture.

The rule of thumb is to find and use the M1 optimized build of the program. As it’s been almost a year since the release of the M1 chip, almost all the major developers have created an M1 version of the build. You can check if your software is having the M1 optimized version on http://isapplesiliconready.com

You can check how many Intel-based programs are running by going to Activity Monitor -> CPU Tab -> Sort by the “Kind” column. As you can see below, I only have very few processes that run on Intel.

Use Safari as the primary browser

That’s right. Whether you love or hate Safari for its UI, compatibility, etc, the truth is that it is highly optimized for the Mac OS and delivers the best energy efficiency.

I was using Brave browser as my default prior to having the Macbook M1 Air and it was really good on privacy, the best of chrome ( since it’s based on Chromium ), and also supported multiple profiles. None of those were there with Safari. But I found that the battery life was really having a difference while using Safari as my primary browser ( browsing, video streaming, etc ). After some initial refusal to accept, I was fine with Safari and found that it’s handling my daily workflow and looked really native and polished.

I still installed Brave and was using it for running chrome apps ( GMeet, Gmail ), etc from the dock when I required them. But the primary browser remains to be Safari.

Specify sleep time for the Mac

I was surprised to learn that the M1 Mac was never intended to sleep or turn off completely by default. When you close the lid, it goes into aggressive power-saving mode. But it still hooks up to the WiFi and also tries to sync your mail and other items while in sleep. This is a good thing as your Mac would be ready to work with the latest updates the next morning.

But sometimes, we may not need to get updates. Like say between 12:00 am to 7 am, you are least bothered about the trending items on Youtube or a mail from another side of the globe. During this time you can configure the Mac to sleep ( like in actual sleep ). This could particularly helpful when you are losing battery overnight.

You can specify the Sleep timing by going to System Preferences -> Battery -> Check the “Sleep” option and specify the time when you want the system to sleep.

Another simple thing that you can check is to close any battery-draining applications like simulators, IDEs, or other services that are keeping the CPU busy. They may consume energy even when the laptop lid is closed.

Developer specific

The below optimizations are relevant if you are a developer and are using M1 Mac as the daily driver.

Turn off services when not in use

Being a full-stack developer, I work with multiple services that may need to have instances running locally ( MySQL, Mongo, RabbitMQ, Redis, Nginx to name a few ). I may not need to use all of them together constantly. It’s a good practice to turn them off when not in use. These services keep on running and use CPU ( and thereby energy ) if not checked.

If they are installed using brew, you could run the below command to see the services

$> brew services list

You can see the list of the services and see that the service status. If it says “started”, then the service is running.

Run the below command to stop the respective service

$> brew services stop <servicename>

When the service is not running, you will be getting the result as below:

If you didn’t install the service using brew, you may need to use the service-specific command for stopping or starting the services.

Close if not required !!

It’s quite common to have a hell of a lot of tabs open in the browser if you are researching a bug or nerve-wracking logic. Now, once you are done with the research, you better close those tabs. Not only does it give that heavenly feeling of accomplishment, but also saves the battery.

The browser may have some optimization to put the tab to sleep when not in use, but many blogs or common websites will be having videos or other serious animations that could be taking memory and CPU.

The same goes with the Utilities and other IDEs that you use. If one is not required, make it a habit to close ( unless it’s something that you use all day ). It’s not just about the battery. You will feel the system is less cluttered and a lot smoother.

Battery saving configurations

The Macbooks are already optimized for the best battery performance and energy efficiency. But there are some settings that are not enabled by default which you can turn on.

Go to “System Preferences” -> “Battery” and enable the highlighted options as in the screenshot below:

Battery configurations

Turn off the keyboard backlight

The Macbook comes equipped with a keyboard backlight that is turned on by default. It is configured to adjust according to the ambient light ( like the screen brightness). In most cases, you won’t be needing the keyboard back-light unless you are working in a dark environment ( without any proper lighting ).

Turn off

There is no direct option available to turn off the keyboard. What we can do is to keep drag the Keyboard Brightness bar all the way to the left

Click on the “Toggles” icon on the Menu bar and choose the “Keyboard Brightness” option

Drag the knob all the way to the left. This will turn off the keyboard backlight

Use web apps instead of native applications

Many of us use a lot of messaging and other productivity apps on a day-to-day basis. The first instinct is to reach out to the App Store and install the native application. The interesting fact is that most of them have got a web-based application that is lighter and with almost similar functionality.

Let’s take the example of Whatsapp web. I installed the native application from the App store and after two days when I checked the Activity Monitor, I was shocked to find that it was using more than 1.5 GB of RAM.

I immediately switched to the web-based version by going to web.whatsapp.com on Safari. Did the same for Notion, Slack, etc.

Pros of using the web-based version

  • You can use an optimized browser like Safari that gives better efficiency
  • Reduced memory footprint
  • You may not have the Apple Silicon optimized native app ( like the case of Whatsapp ) and it may drain more power.
  • A bonus advantage that you will save on the storage ( Whatsapp was 500 MB when installed, similar for Slack and Notion )

Cons

  • Reduced functionality ( reply to notification, additional actions, etc )
  • Notifications always come from Safari ( or the browser that you use )
  • Need to manage the browser tabs

Remove external devices if not required

With the exorbitant pricing of the storage by Apple, most of us are used to supplement the storage requirements using an external hard drive. It’s a common behavior that we keep it plugged even if it’s not used. It’s always advisable to remove such media and peripherals ( Bluetooth dongle, external hubs, etc ) when not in use.

Footnotes

The above-mentioned configurations are only relevant when you are worried about battery life or in a work environment where you don’t have good access to the power port. If you don’t bother about plugging in the power cable multiple times ( or maybe keep it plugged in ), you are not required to follow any of these and use the Macbook as the tool it is.

I for myself would like to be not bothered by the power ( especially while working from home right now ) and don’t mind tweaking the settings and doing some sacrifices on the apps that I use.

You may also like...

2 Responses

  1. September 10, 2021

    […] along with the same workload with a 9 to 9 ( 12 hours ) battery life in my Mac. I have made a post on the optimizations I did for this. Now it has become a habit for me to charge the laptop for like 2 hours towards the end of the day […]

  2. December 14, 2021

    […] How to get full work day battery life from M1 Mac […]

Leave a Reply

Your email address will not be published. Required fields are marked *