Wednesday, October 26, 2016

App Nap Slowing My Mac?

What Is App Nap? Is it Slowing Down My Mac Apps?

mac-app-nap-sleeping

App Nap, added to macOS back in 2013, is not a feature that made headlines. So there’s no shame in admitting, three years later, that you still have no idea what it does.

To summarize: App Nap puts programs you’re not currently using or looking at to “sleep”, blocking them from using system resources, especially the CPU, until you focus on them again. If you have 20 windows open, only the things you’re currently using should be using system resources and battery life. The energy savings can add up.

App Nap should not be confused with Power Nap, a similarly named feature which allows your Mac to do things like download updates or create backups while suspended. The two features are unrelated.

What App Nap Does

App Nap was one of the energy features added with macOS (then OS X) 10.9 Mavericks. Other tweaks include a list of “Apps Using Significant Energy”, which was added to the battery icon.

energy-wasting-app

App Nap is a related optimization, blocking inactive applications from using the CPU and other system resources. This keeps your computer’s resources free, and saves battery life.

When is an application considered “inactive”? According to Apple’s developer guidelines, App Nap is triggered only if an application:


  • Isn’t the foreground app.
  • Hasn’t recently updated content in the visible portion of a window.
  • Isn’t audible.
  • Hasn’t taken any IOKit power management or NSProcessInfo assertions.
  • Isn’t using OpenGL.

What does this mean? First of all, the application that you’re currently using will not go to sleep. The same goes for any application that you can currently see, assuming the part of the window you can see is currently getting updates. Any application that’s making sounds also will not go to sleep, which is good news if you like to leave your music player running in the background.

The idea here is that any application that’s not currently doing anything for you should not be using up any of your resources. Applications wake up as soon as you open their windows again, and in theory this shouldn’t affect performance at all (except in a positive way, by leaving resources open for the apps you’re actually using).

How to Check if an App Is Currently Napping


App Nap is not, broadly speaking, a user-facing feature. There is no indicator, on the dock or otherwise, that shows you whether an application is currently napping. For that, you need to head to the Activity Monitor, which you can find in Applications > Utilities, or by searching Spotlight.

app-nap-activity-monitor

Head to the “Energy” tab and you’ll see a column for “App Nap.” A “Yes” here means that a given application is currently napping. Open the application in question and it will instantly wake up, and Activity Monitor will read “No” in the column.

The idea is for applications to wake up so quickly that users don’t even notice the nap happened. But if you think this might be slowing some of your apps down, you might have recourse.

How to Disable App Nap, Entirely or for Certain Apps

App Nap is applied to all applications, regardless of whether they were built with the function in mind or not. This could, at least in theory, cause problems for certain older apps, preventing background updates or causing slowdowns. If you suspect App Nap is causing problems, there’s an easy way to find out.

First, find your application in Finder, then right-click it.

spatterlight-right-click

Click “Get Info”, and you might see the option to Prevent App Nap.

get-info-disable-app-nap

The option won’t be offered for every app; generally the option is only seen if applications weren’t specifically created with App Nap in mind. In our experience, this means the option primarily shows up for applications built in 2013 or earlier, though there are exceptions. If possible, disable App Nap for your program and see if your problem is solved.

Alternatively, you can disable App Nap entirely with a single command. Open the Terminal, which you can find in Applications > Utilities or by searching with Spotlight. Then run this command:

defaults write NSGlobalDomain NSAppSleepDisabled -bool YES

This will disable App Nap entirely. If doing so fixes a problem you’ve had with an app, consider writing that app’s developer and letting them know. Once you’ve done that, you can re-enable App Nap with this command:

defaults delete NSGlobalDomain NSAppSleepDisabled

App Nap is, overall, a feature worth keeping enabled unless you specifically have a problem. The better battery life alone makes the feature worthwhile, and most users will never notice that anything is even happening. But it’s good to know how to disable things just in case.

No comments:

Post a Comment