
Before we start: Mac disk management tool - such as DMcleaner for Mac can handle most of tasks and requirements on Mac. It is easy to use this tool to quickly prevent a Mac from sleeping and improve the performance of the Mac system. Try it now!
PAGE CONTENT:
Keeping your Mac awake can be essential during extended downloads, file transfers, presentations, or when running long scripts or rendering jobs. macOS is designed to conserve energy by putting your system or display to sleep after a period of inactivity. While this is great for battery life and hardware longevity, it can interrupt critical workflows.
In this guide, we'll cover how to prevent your Mac from sleeping using built-in settings, Terminal commands, and third-party tools - so you can maintain full control over when your device sleeps.
Understanding Mac Sleep Behavior
Before diving into solutions, it's helpful to understand how macOS handles sleep.
Types of Sleep on a Mac:
- System Sleep: Puts the processor, memory, and other components in a low-power state. Background tasks pause unless Power Nap is enabled.
- Display Sleep: Turns off the screen but keeps the system awake. Apps can continue to run.
- Hard Disk Sleep (on Macs with HDDs): Spins down the disk when inactive, saving power.
macOS initiates sleep based on a variety of conditions: idle time, battery level, lid closure, and energy settings. By default, the system is optimized to save power and reduce wear and tear on hardware components.
How to Stop Your Mac from Sleeping? [4 Methods]
Method 1: Prevent Sleep via System Settings
The easiest and most direct way to prevent your Mac from sleeping is through System Settings (macOS Ventura and later) or System Preferences (macOS Monterey and earlier).
For macOS Ventura and Later:
- Click the Apple menu > System Settings.
- Navigate to Lock Screen and Displays.
- Under Lock Screen, set "Start screen saver when inactive" and "Turn display off on battery/power adapter when inactive" to Never.
For macOS Monterey and Earlier:
- Go to Apple menu > System Preferences > Energy Saver (or Battery on laptops).
- Drag the "Turn display off after" slider to Never.
- Check the option: "Prevent computer from sleeping automatically when the display is off" (if available).
- Optionally uncheck "Put hard disks to sleep when possible."
💡 Note: On MacBooks, these options vary slightly depending on whether the device is on battery or plugged in.
Method 2: Use the Terminal with 'caffeinate' Command
If you're a developer, IT professional, or just someone comfortable with the command line, macOS provides a powerful built-in utility called caffeinate. This command-line tool lets you temporarily prevent your Mac from sleeping based on specific conditions. It's fast, flexible, and doesn’t require installing any additional software.
The name is a nod to keeping your Mac "awake" - just like a cup of coffee does for you.
1. Basic Usage of caffeinate
To begin using the command:
- Open Terminal from Utilities via Applications.
- Type:
Caffeinate
- Your Mac will now stay awake indefinitely as long as this Terminal window remains active.
To stop the process, press Control + C in the Terminal, which will cancel the command and allow your Mac to resume its default sleep settings.
2. Advanced Flags and Options
The caffeinate command is powerful due to its multiple flags that give you fine-grained control over different types of sleep prevention:
Flag | Function |
---|---|
-t | Prevent sleep for a specific time (in seconds) |
-d | Prevent display sleep |
-i | Prevent system idle sleep |
-m | Prevent disk sleep |
-s | Prevent sleep while a command runs |
Example 1: Keep the system awake for 2 hours
caffeinate -t 7200
This keeps the system from sleeping for 7200 seconds (2 hours). This is ideal for time-boxed tasks like long downloads or compiles.
Example 2: Prevent display sleep only
caffeinate -d
Your Mac's display will stay on, but system sleep and disk sleep behaviors won’t be affected.
Example 3: Prevent sleep while another process runs
caffeinate -s ./render_video.sh
In this case, your Mac will stay awake for the entire time render_video.sh runs. Once the script finishes, the sleep settings return to normal.
This is especially useful for developers, video editors, or sysadmins running automated scripts.
3. Combining Flags for Greater Control
You can combine flags to create a customized session:
caffeinate -di
This prevents both display and idle sleep - handy if you're monitoring a long-running process and need both the screen and system to stay active.
Another example:
caffeinate -di -t 3600
This keeps your display and system active for 1 hour only.
4. Backgrounding the caffeinate Command
You might not want the Terminal window open the entire time. You can run caffeinate in the background:
caffeinate -di &
This sends the command to the background. To stop it, find its Process ID (PID) using ps:
ps aux | grep caffeinate
Then kill the process using:
kill <PID>
5. Practical Use Cases for caffeinate
- Large File Downloads: Prevent sleep while downloading files overnight.
- Long Render or Build Jobs: Software development builds or 3D renderings won't be interrupted.
- Remote Access Sessions: Keep your Mac awake while accessing it remotely via SSH or screen sharing.
- Live Demos or Presentations: Prevent embarrassing screen blackouts or system sleep during meetings.
6. Bonus Tip: Automate with Shell Scripts
You can create a simple shell script to run caffeinate with your preferred settings:
#!/bin/bash
# Keep Mac awake for 3 hours
caffeinate -di -t 10800
Save it as stayawake.sh, give it execute permissions:
chmod +x stayawake.sh
And run it with:
./stayawake.sh
This is useful for repetitive tasks where you need to keep the Mac awake for a known duration.
Method 3: Use Third-Party Utilities to Keep Mac Awake
Third-party apps offer user-friendly interfaces and more advanced control over when and how your Mac stays awake. Here are three of the most popular:
1. DMcleaner for Mac
- Download and install DMcleaner for Mac.
- Open DMcleaner for Mac.
- Choose Switch Manager, turn on "Keep Awake."
2. Amphetamine
- Availability: Free on the Mac App Store.
- Features:
- One-click activation.
- Session-based awake modes (e.g., for 2 hours, while a file downloads, etc.).
- Auto-start and scheduling options.
- Keeps display and/or system awake.
- Usage:
- After installing, click the pill icon in the menu bar.
- Choose duration or custom trigger.
3. KeepingYouAwake
- Availability: Open-source alternative to Amphetamine.
- Features:
- Lightweight, minimal interface.
- Menu-bar access.
- Custom duration settings.
4. Lungo
- Availability: Paid app with a clean interface.
- Features:
- Simple duration toggles.
- Low resource usage.
- Menu-bar icon for quick access.
Why use third-party apps?
They provide features like automatic sleep prevention when connected to a specific Wi-Fi, during specific app usage, or according to a time schedule.
Method 4: Prevent Sleep During Specific Tasks
macOS sometimes stays awake automatically, depending on activity. Here are some built-in behaviors and settings you can use to keep your Mac awake without additional configuration.
1. Full-Screen Mode and Media Playback
- When playing videos in full-screen (e.g., YouTube, VLC, QuickTime), macOS may delay sleep.
- Ensure apps are allowed to prevent sleep in System Settings > Battery > Options.
2. External Displays and Clamshell Mode
- Connecting an external monitor can keep a Mac awake, especially when using Clamshell Mode (MacBook closed, external monitor, keyboard, and power source).
3. While Sharing Files or Using Remote Access
- Activities like AirDrop, Time Machine backups, file sharing, or remote desktop may temporarily prevent sleep.
- For longer sessions, combine with caffeinate or an app like Amphetamine.
4. While on Power Adapter
- You can configure different sleep settings for Battery and Power Adapter modes under System Settings > Battery.
- Set sleep and display off to Never when plugged in.
Best Practices and Considerations
While preventing your Mac from sleeping is useful, consider the impact on system health, energy usage, and security.
1. Battery Wear
- Keeping a MacBook awake and running continuously on battery can accelerate battery degradation.
- Use sleep prevention sparingly on battery, and prefer wall power when keeping the Mac awake.
2. Heat and Performance
- Long awake sessions can generate heat. Make sure your Mac is well ventilated.
- Avoid keeping the screen brightness at 100% for extended durations to prevent burn-in (especially on OLED displays like some MacBook Pros).
3. Use Sleep Timers and Auto-End Sessions
- Most third-party apps offer timed sleep prevention.
- Use these instead of leaving your Mac awake indefinitely.
4. Be Mindful of Privacy and Security
- If your Mac is awake in public or shared spaces, ensure your screen locks after inactivity or manually lock it with Control + Command + Q.
Troubleshooting: Mac Still Sleeps?
Even after making adjustments, your Mac may still sleep unexpectedly. Try these troubleshooting tips:
1. Screen Saver Settings
Go to System Settings > Screen Saver and ensure it's not set to activate too quickly.
2. Reset SMC or NVRAM
- Sometimes power management glitches require resetting the System Management Controller (SMC) or NVRAM.
- Refer to Apple Support for device-specific steps.
3. Energy Saver Bugs
- macOS updates occasionally introduce bugs in energy settings.
- Check for updates: Apple menu > System Settings > General > Software Update
4. Conflicting Apps or MDM Profiles
- Certain corporate profiles or apps (e.g., antivirus, VPNs, or IT management tools) may override user sleep settings.
- If applicable, check with your system administrator.
Conclusion
Keeping your Mac from sleeping is simple and highly customizable. Whether you're watching a long video, downloading large files overnight, or giving a presentation, there are methods suitable for every type of user.
To recap:
- System Settings are the best for straightforward, OS-integrated adjustments.
- Terminal (caffeinate) offers advanced control for developers or power users.
- Apps like DMcleaner for Mac provide the most flexibility and ease-of-use.
- Built-in macOS behaviors (like full-screen video) can delay sleep when appropriate.
Always balance performance and productivity with energy efficiency and hardware care. Use timed wake sessions, especially on laptops, and make sure your screen is set to lock for security.
With the right tools and a bit of configuration, you can ensure your Mac stays awake precisely when you need it - and sleeps when you don't.


DMcleaner for Mac
Donemax DMcleaner for Mac is an award-winning Mac cleanup & maintenance application. It offers 10+ tools to help Mac users clean up junk data on Mac, uninstall unwanted apps & delete leftovers, shred files, delete duplicate files, free up disk space, speed up slow Mac, etc. It is also a smart switch manager for Mac, a powerful disk manager for Mac.
Related Articles
- Apr 10, 2025Fixed: MacBook Pro Won't Boot from Internal Disk
- Nov 07, 2024Downgrade from macOS Sequoia to macOS Sonoma or Earlier Versions
- Jun 19, 2025How to Use SD Card on Mac – A Complete Guide
- Jul 01, 2025[7 Fixes] Fix 'Your Computer Was Restarted Because of a Problem' on Mac
- Feb 17, 2025Fix XQD Card Not Showing Up or Not Mounting on Mac [10 Fixes]
- Feb 06, 2025[4 Methods] Fix The Volume Macintosh HD Was Found Corrupt and Needs to Be Repaired

Steven
Steven has been a senior writer & editor of Donemax software since 2020. He's a super nerd and can't imagine the life without a computer. Over 6 years of experience of writing technical solutions and software tesing, he is passionate about providing solutions and tips for Windows and Mac users.

Gerhard Chou
In order to effectively solve the problems for our customers, every article and troubleshooting solution published on our website has been strictly tested and practiced. Our editors love researching and using computers and testing software, and are willing to help computer users with their problems