How do I prevent sleep mode on Mac when running an app

I have one app that needs to run several hours sometime.

Even with the power adapter plugged in my Mac goes into sleep mode after a bit and the app stops.


How can I set my Mac to stay awake when running certain apps?

MacBook Air (M4, 2025)

Posted on Nov 19, 2025 5:51 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 19, 2025 5:53 AM

I use an app from the App Store called "Amphetamine".


It supports a whole host of options for keeping your Mac awake and alive, including options to do so when a specific app is running.


(I have no connection to the app or developer other than as a user. It's free by the way. No ads.

4 replies

Nov 19, 2025 7:46 AM in response to steenrocks

For greater control of the situation, the suggestion from @ KiltedTim is probable better


For occasional use


Terminal application 

Type as per below


man caffeinate


There are variously options and switches that are available


caffeinate -s


Create an assertion to prevent the system from sleeping. This  assertion is valid only when system is running on AC power.


caffeinate -i 


Create an assertion to prevent the system from idle sleeping.


caffeinate -i make


        caffeinate forks a process, execs "make" in it, and holds an assertion that prevents idle sleep as long as that process is running.


How do I prevent sleep mode on Mac when running an app

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.