How to turn off sleep mode on macOS Sequoia or earlier?

I’m downloading a huge file which is estimated to take several hours. How do I turn off sleep mode on my Mac to prevent it from interrupting the download? Also, how can I keep my Mac on when I close the lid? BTW, is there a way to schedule a sleep time on Mac?

How to turn off sleep mode on your MacBook or desktop Mac:

The steps to turn sleep mode off on a Mac differ on different macOS versions. I’ll try to cover the steps for each popular version in case someone else may need it.

On macOS Ventura, Sonoma & Sequoia:

  1. Open System Settings > Lock Screen.
  2. Set “Turn display off when inactive” to Never.
  3. Choose Energy Saver from the sidebar.
  4. Turn off “Prevent automatic sleeping when the display is off.”

On macOS Monterey & Big Sur:

  1. Open System Preferences > Energy Saver.
  2. Slide the “Turn display off after slider” to Never to permanently keep your Mac on all the time.
  3. Click OK if you see a warning about your Mac using more energy.
  4. Tick the box next to “Prevent your Mac from automatically sleeping when the display is off.”

On macOS Catalina and earlier:

  1. Open System Preferences > Energy Saver.
  2. Slide the “Computer sleep” slider to Never.
  3. Disable “Put hard disks to sleep when possible.”

There are two ways to turn your Mac’s screen off without going to sleep.

If you just want the sleep mode off temporarily, you can run a simple command in Terminal by following the steps below:

  1. Open Terminal from your Applications/Utilities folder.
  2. Type the following command and hit Enter.

caffeinate

As long as this Terminal window is open, your Mac will stay awake even when its lid is closed.

However, if you’d like to keep your Mac on when its lid is closed permanently until you modify the settings again, you can:

On macOS Ventura, Sonoma, Sequoia:

  1. Open System Settings > Lock Screen.
  2. Set “Turn display off on battery when inactive” to Never.
  3. Set “Turn display off on power adapter when inactive” to Never.

You can schedule sleep on Mac via Terminal. Here’s how to do it:

  1. Open Terminal by going to Finder > Applications > Utilities folder.
  2. Input the proper command and hit Enter.
    For example, to put your Mac into sleep mode Monday to Friday at 5p.m., run:
    sudo pmset repeat sleep MT 17:00:00
    To revert the settings, run:
    sudo pmset repeat cancel
    To check your current power settings:
    pmset -g