Screenshot 2023-06-29 at 2.14.45 PM

How To Keep Your Mac Awake For Long Hours or Tasks ?

Whether we’re burning the midnight oil for an Office preparation, embarking on a long drive, or indulging in an OTT binge-watching session, we often rely on tried and tested products to keep us from dozing off. Similarly, our computer systems have their own built-in mechanisms to conserve energy, causing them to enter sleep or hibernation mode when left unattended for a certain period.

While this is helpful in saving power, it can be frustrating when long-running tasks, like large file downloads, get interrupted. In today’s edition of DIY IT Diagnostic, we present a simple workaround to tackle this issue – Caffeinate, a built-in command that can keep your Mac awake when you need it the most.

What is Caffeinate?

Caffeinate is a powerful command-line tool that prevents your Mac from going to sleep or entering idle mode. By using the Caffeinate command in the Terminal, you can override the default sleep settings and keep your Mac awake for as long as you need.

How to Use Caffeinate?

  1. Launch the Terminal on your Mac by pressing Cmd+Space and typing ‘Terminal‘ in the search bar.
  2. Once the Terminal window opens, type “caffeinate” and hit Enter. This command will prevent your Mac from entering sleep mode until you explicitly stop it.
  3. Press ‘Control+C‘ to cancel.

How to use Caffeinate to until a process is running?

You can also use this command to link with a specific process, in that way, this will prevent the mac from going to to sleep untill that process is running

  1. First, find out the Process ID. Go to ‘Activity Monitor‘ and note down the “PID“. For Example, below, Safari has a Process ID of ‘1066’

2. Then open “Terminal” by pressing Cmd+Space and type ‘Terminal’ and and press ‘Enter’

3. In the Terminal, enter the following command: “caffeinate -w [Process ID]”. Replace [Process ID] with the actual ID of the process you want to monitor, which in our case is Safari, i.e. 1066. and press Enter.

This will keep your Mac awake until the specified process is running. So in our case, as long as Safari is running in the background, our Mac will Stay Awake.

Benefits and Applications:

Caffeinate offers a simple and effective solution to keep your Mac awake during critical tasks. Whether you’re running a time-consuming script, downloading a large file, or need uninterrupted access to your system, Caffeinate ensures that your Mac stays awake and active. It’s a versatile tool that can come in handy in various situations, providing you with uninterrupted workflow and preventing any disruptions caused by your Mac’s sleep mode


With the Caffeinate command, you now have the power to keep your Mac awake and responsive when you need it the most. By leveraging this simple yet powerful tool, you can prevent your Mac from entering sleep or idle mode, ensuring that time-consuming tasks are completed without interruption. Whether you’re a developer, content creator, or a user with specific requirements, Caffeinate can be a valuable addition to your workflow. So, the next time you need your Mac to stay awake, give the Caffeinate command a try and enjoy uninterrupted productivity.

Similar Posts