Debugging Hardware Battery Drain: How Web Developers and SaaS Creators Can Fix macOS Sleep Mode Issues

published on 20 August 2026

For web developers and SaaS founders, a MacBook often serves as a local server, a testing browser, a development environment, and a communication hub all at once. That’s why it’s quite common to close your laptop when it’s at 80% charge and find it almost completely drained a few hours later. In many cases, the problem isn’t due to a worn-out battery, but rather because macOS doesn’t actually enter normal sleep mode. When Mac sleep mode does not work, the system may remain active due to local servers, browser tabs, Node.js processes, Docker containers, or synchronization tools. These cause imperceptible power consumption over the course of hours. However, you can diagnose this problem systematically rather than by trial and error.Ы

Source : unsplash.com
Source : unsplash.com

Why Sleep Mode Doesn't Work as Expected

macOS uses a complex power management system that considers:

  • Process activity,
  • Network requests,
  • Connected devices,
  • Background services.

If any process signals to the system that it needs to remain active, the laptop may not go into sleep mode completely. This is especially relevant for developers. Vite, Laravel, Next.js, PostgreSQL, Redis, or Docker local servers may remain active even after the laptop lid is closed. This results in the battery continuing to drain, even though the computer seems to be in sleep mode. That’s why you should start not with in-depth diagnostics, but by checking the most common causes of this system behavior. If you need a practical list of Mac won't go to sleep fixes, be sure to check your sleep mode settings, active applications, and external devices. Also, don’t overlook network settings that might be keeping the system active. This check will help you distinguish obvious causes from those specifically related to development tools and background processes.

Check what’s keeping the system active

The most valuable diagnostic tool is the pmset command.

Open Terminal and run:

pmset -g assertions

This command shows the processes that are preventing the system from entering sleep mode.

Typical output may include:

  • PreventSystemSleep
  • PreventUserIdleSystemSleep
  • BackgroundTask

If Google Chrome, node, Docker, backupd, or another process appears in the list, you’ve already found your first clue.

Take note of the PID process. You can check it with the command:

ps -p PID -o command

This way, you’ll see the specific script or service running in the background.

Local Servers as the Main Source of Hidden Resource Consumption

Docker Desktop is one of the most common sources of issues in developer workstation troubleshooting.

Building a landing page or website locally often involves more than editing HTML and CSS. Developers may run a local development server, preview responsive layouts in several browser windows, connect forms to a local API, test analytics scripts, or use a CMS and database during development. If these services remain active after the work session ends, they can continue using CPU, memory, network resources, or background processes while the Mac appears to be idle. For a website builder working across several projects, closing unused development servers and browser sessions before putting the Mac to sleep can therefore be a simple part of the daily workflow. 

Even when not actively in use, the following may remain running:

  • A Docker virtual machine;
  • Containers;
  • File synchronization;
  • Network services.

Check for active containers:

docker ps

If they’re not needed, use:

docker stop $(docker ps -q)

After that, it’s best to completely close Docker Desktop.

Node.js and modern front-end tools

When developing with Next.js, Astro, Nuxt, Vite, or other modern frameworks, the dev-server process often stays active after you’re done working.

A common scenario looks like this:

  1. The browser is closed;
  2. The code editor is closed;
  3. The Terminal remains open;
  4. The Node.js process continues to run.

You can check this with the command:

ps aux | grep node

If the list contains multiple dev processes, terminate them using:

kill PID

or

pkill node

Make sure that after doing this, pmset -g assertions no longer shows any sleep mode blocks.

Source : unsplash.com
Source : unsplash.com

Browsers May Cause More Sleep Disruption Than You Think

Edge, Chrome, and other Chromium-based browsers actively use background processes.

This is especially true for:

  • Local admin panels;
  • Tabs with WebSockets;
  • DevTools;
  • SaaS dashboards;
  • PWAs;
  • Extensions.

How to check a browser’s energy consumption

Open Activity Monitor. Go to the Energy tab. Pay attention to:

  • Energy Impact;
  • Preventing Sleep.

If Chrome or a specific process is marked as preventing sleep, you should close the corresponding tabs. This happens particularly often when you are working with local APIs or real-time systems.

Settings to Check

In recent versions of macOS, the Energy Saver settings are located in System Settings → Battery.

Check:

  1. Wake for network access;
  2. Power Nap (if available);
  3. Automatic wake-up when plugged in;
  4. Optimized charging.

If you don’t use remote access, then for a laptop used as a SaaS developer setup, it usually doesn’t make sense to keep Wake for network access enabled.

How to know if the problem is with the hardware

Don’t immediately suspect the battery. First, check the charge cycle.

Run:

system_profiler SPPowerDataType

Pay attention to:

  • Cycle Count;
  • Maximum Capacity.

The problem is often software-related if the maximum capacity exceeds approximately 80% and there are few cycles.

Source: unsplash.com
Source: unsplash.com

Practical Troubleshooting Procedure

1. Check the assertions.

pmset -g assertions

2. Close local servers.

3. Close browsers. Especially those that use local addresses (localhost, 127.0.0.1).

4. Disconnect external devices.  USB drives, hubs, monitors, and audio interfaces can sometimes keep the system active.

5. Check the assertions again. If the list is empty, the problem has been found.

Typical scenarios for SaaS teams

Many small SaaS projects use the same set of tools. And each one on its own may not cause problems, but their combination may prevent the system from entering sleep mode properly. It is good, however, to make a habit to end your session with a command that stops local services.

For instance, using a Makefile or shell script:

docker compose down

pkill node

This takes a few seconds and often helps you prevent battery drain on a Mac without additional utilities.

Automating checks

If you regularly encounter this problem, create a simple script:

pmset -g assertions

ps aux | grep node

docker ps

You can run it before you close your laptop. This approach is more efficient than if you manually search for the cause each time.

Conclusion

Sleep mode issues on a MacBook are rarely random for developers. Most often, they’re caused by local servers, browser processes, or other tools that stay active after work is finished. Running a system check using pmset, Activity Monitor, and monitoring local services will help you quickly pinpoint the source of the problem. Clean your work environment regularly, check macOS power management, and optimize your SaaS developer setup to:

  • Conserve battery life, 
  • Prevent your laptop from overheating, 
  • Make working with macOS more predictable.

For most web developers, these are technical habits that pay off every day.

Read more

Built on Unicorn Platform