How to prevent app falling in sleeping status on Mac?

Solution 1:

You can disable the App Nap feature on any app by finding it in Applications, Get Info, then uncheck App Nap.

enter image description here

The App Nap checkbox doesn't appear for all apps - & I can't figure out what determines that.

Otherwise, you can disable it globally from Terminal using the command
defaults write NSGlobalDomain NSAppSleepDisabled -bool YES