While waiting for a long-running QGIS process to finish I was reminded that macOS 10.9 (“Mavericks”) introduced a feature called App Nap, which suspends or pauses applications that aren’t visible on screen. A few seconds after I switching away from the Spaces virtual desktop that QGIS was running on, macOS would suspend QGIS, preventing the process I was waiting on from ever completing. In earlier versions of macOS there was a checkbox to disable App Nap on a per-application basis in the Get Info window for the app. Between macOS 10.9 and macOS 13, this checkbox seems to have been removed. After some digging I found the property list key that controls App Nap is NSAppSleepDisabled. This key can be set to true for the global domain to disable App Nap system-wide, or on a specific app’s property list to disable it for just that application. I decided on the per-application route. First, I needed to discover the bundle identifier for QGIS:
$ mdls -name kMDItemCFBundleIdentifier /Applications/QGIS.app kMDItemCFBundleIdentifier = "org.qgis.qgis3"
Then I just needed to set the property list key for QGIS:
defaults write org.qgis.qgis3 NSAppSleepDisabled -bool YES
After relaunching the QGIS app, the App Nap issue was resolved—QGIS will continue to run even when its window is on an inactive virtual desktop!