How to stop Mac from sleeping guide

7 min read

You're definitely familiar with this feature. When you don't work with your Mac for a while, its screen dims, and then the computer goes off. This means that it has moved into sleep mode.

On the one hand, this is an invaluable feature because it saves power consumption, which is especially helpful when you're running on battery power and not connected to the mains. On the other hand, going into sleep mode can disrupt some processes or just be annoying.

That's why it's worth learning how to manage sleep modes on your Mac and find out how to stop your Mac from sleeping.

What is sleep mode on a Mac?

Sleep mode is a mode of macOS in which the display turns off, the processor runs in power-saving mode, and the hard drive and some background processes are paused. The computer stays on and uses less power, but it still drains a little if it's not connected to a network.

It's a super useful feature, but it can be inappropriate sometimes. Let's say that you're downloading a large file, and the Mac falls asleep at this time. The download may fail. Or your job requires you to use a computer occasionally rather than all the time. For example, you communicate with clients and only periodically enter data into your laptop. Constantly clicking on the keyboard and entering a password to wake up your Mac can be annoying.

So, we need to deal with this. But first, let's look at sleep modes.

There are three sleep modes, one of which will be the default depending on the type of macOS you have. Check yours, and then compare it to our explanation below.

  1. Click on Launchpad (it's an icon with a total of nine squares of different colors on the Dock)
  2. Type "Terminal" in the search bar
  3. When the Terminal window opens, enter the following combination in it: pmset -g | grep hibernatemode and press Enter.

The Terminal will show you the sleep mode for your Mac:

  • hibernatemode 0 (standard sleep)
  • hibernatemode 1 (hibernate mode for pre-2005 portable MacBooks)
  • hibernatemode 3 (safe sleep)
  • hibernatemode 25 (for post-2005 MacBooks).

terminal sleepmode mac

Let's take a closer look at them.

  1. Standard sleep. RAM is enabled, and all unsaved files, documents, and processes are stored in it. Waking up from sleep is very fast.
  2. Hibernate mode. RAM is turned off, so before hibernating, the startup drive saves data from the RAM. The Mac wakes up a little longer because it copies data from the disk back to RAM.
  3. Safe sleep. The RAM remains on, but the startup drive still saves data from the RAM. With this combination, your Mac wakes up as quickly as it would from Standard sleep.

You can change the sleep mode on your Mac by entering the following command at the Terminal: 

sudo pmset hibernatemode X

Note: Instead of X, you need to use 0, 1, 3, or 25 (the number of the mode you want to have). Remember, though, that by default, a Mac has the mode that suits its model. So we usually don't recommend changing this setting.

Now that we're familiar with the theory let's move on to practice and find out how to keep Mac from sleeping.

One-click solution to prevent your Mac from sleeping

Setting up sleep modes using standard Mac tools, which we'll discuss later, requires you to dig through the settings. This is not a big deal if you only need to do it once. But if you need to change your settings from time to time, then endlessly opening preferences will definitely become annoying.

In this case, use Lungo, an app that will prevent Mac from sleeping for as long as you want. And you can do it with just one click.

After installing the app, an icon with a cup of coffee will appear at the top of the screen. Click on it and specify the desired wake-up time. Simple, isn't it?

prevent mac from sleeping using lungo

How to change sleep time on macOS Ventura?

As we said, the settings differ slightly from OS to OS. macOS Ventura, the latest version of macOS, lets you customize your battery and power settings.

How to turn off sleep mode on Mac with macOS Ventura:

  1. Click the Apple logo in the upper-left corner of the screen
  2. Click System Settings
  3. Scroll down the sidebar and click on Lock Screen
  4. Find the line "Turn display off on power adapter when inactive" in the right panel and click on the drop-down next to it
  5. Set the sleep time by selecting the desired option in the drop-down window (from 1 minute to never)
  6. Find the line "Turn display off on battery when inactive" and repeat step 5.
sleeptime macos ventura

How to keep MacBook from sleeping on macOS Big Sur and Monterey

Big Sur and Monterey have similar systems for changing sleep patterns.

How to change sleep time on Mac while running on battery power:

  1. Click the Apple logo in the upper left corner and go to System Preferences
  2. Click Battery
  3. Move the slider at the top of the screen to Never.
prevent mac monterey from sleeping

How to prevent your Mac from sleeping while running on battery power:

  1. Click the Apple logo in the upper left corner and go to System Preferences
  2. Click Battery
  3. Choose Power Adapter from the sidebar menu on the left
  4. Move the slider to adjust the display off time.
prevent mac from auto sleeping when display off

How to make Mac not sleep on macOS Catalina and older

macOS Catalina and older versions have a slightly different design, but the essence of the settings is the same: to set up separate battery and mains operations.

  1. Click on the Apple icon
  2. Choose Setting Preferences
  3. Click Energy Saver
  4. Move the slider at the top of the screen to Never
  5. Check the boxes next to all the lines you see.
stop sleeping macos catalina

How to prevent Mac from going to sleep when closing the lid

By default, your Mac goes to sleep as soon as you close the lid. This is logical and good: the battery is saved, and after opening the lid, you just need to enter the password and continue working.

But if, for example, you use an additional monitor for work and want to close the laptop, you don't need to switch to sleep mode.

Here's how to stop your Mac from sleeping with the lid closed on macOS Ventura:

  1. Go to the Apple menu > System Settings
  2. Choose Displays in the sidebar
  3. Then click Advanced
  4. Check "Prevent automatic sleeping when display is off"
  5. Click Done to save changes.

prevent sleep when closing lid

Here's how to stop your Mac from sleeping with the lid closed on macOS Monterey and earlier:

  1. Click the Apple icon in the upper left corner of the screen
  2. Choose System Preferences
  3. Click on Energy Saver
  4. Find the line "Prevent your Mac from automatically sleeping when the display is off," select the checkbox, and confirm.

automatically sleeping when display is off

How to prevent Mac from sleeping with Terminal

If you want to make temporary changes to the sleep settings, you can do this through the Terminal. The changes will be active as long as the Terminal window is open.

  1. Click on Launchpad
  2. Type Terminal in the search bar
  3. Enter the following command in the Terminal: caffeinate -d
  4. If you want to keep your laptop awake for a certain amount of time, type caffeinate -t X, where X is the number of seconds.

prevent mac from sleeping with terminal

Simplify switching between modes by downloading One Switch. This is an app that allows you to change settings in one click. Once you install the app, you'll see its logo on the top of your screen. Click on it, and you'll see the Keep Awake button, which allows you to customize the awake time or even disable the transition to sleep mode when the lid is closed.

one switch keep mac awake

You can also customize the menu by adding the settings you use most often and speed up processes. For example, connecting AirPods will take one step, not five as usual.

How to schedule sleep on your Mac

Your Mac (macOS Monterey and some earlier) has a handy feature for people who need to turn their computers on and off at the same time consistently. Here's how to set up a power-on and power-off schedule:

  1. Click the Apple icon > System Preferences
  2. Click on Energy Saver
  3. Click on Schedule
  4. Set the necessary parameters:

Start or wake: on weekdays, weekends, every day, or on a specific day

Sleep, restart, or shut down: on weekdays, weekends, every day, or on a specific day.

schedule sleep on mac

If you use your Mac autonomously all the time, it's a good idea to extend its endurance. Install Endurance, and the battery life will increase by up to 20%. For example, the app gradually reduces the brightness of the screen. You are not inconvenienced, and the battery lasts longer. This is a useful app for those who turn on or off their laptop on a schedule but don't always start working the moment the Mac is turned on.

endurance dim screen

The best solution how to stop Mac from sleeping

So, the answer to your question "Why does my Mac keep going to sleep?" is that it's all about your settings. 

In general, there are three ways to change sleep settings: through preferences, the Terminal, or an app.

The sleep settings differ from macOS to macOS, but usually, you need to go to System Preferences > Lock Screen / Battery / Energy Saver > Battery or Power.

In the Terminal version, you need to launch Terminal, enter the caffeinate -d command, and press Enter.

However, the easiest way to customize your sleep mode, and the one that frees you from digging through the settings, is through apps like Lungo, OneSwitch, and Endurance. All of them are on Setapp along with 240+ other apps that solve a variety of Mac, iPhone, and iPad tasks. Setapp offers a subscription-based model. It typically involves a monthly or annual subscription fee to access the entire collection of apps. One subscription, dozens of awesome apps! Give it a try and see how it can change your life. All apps are free during a seven-day trial. 

240+ apps for $9.99
per month

Sign up to Setapp and try them for free.