How to Keep a Mac Awake With the Lid Closed
An upload or build can stop when you close your MacBook. The right solution depends on whether you have an external display, need the lid closed, or simply want to prevent idle sleep.
Written by Pratik Nayak, the developer of Stay Awake. This guide includes free options as well as our app. Updated November 5, 2026.
If you have an external display
Start with Apple's supported closed-display setup. Connect your display, a power source, and an external keyboard and mouse. You may not need a keep-awake app at all. Check the requirements for your Mac and approve connected accessories before closing the lid.
Apple's external-display guidance ↗
If the lid can stay open
For a long download or build at your desk, preventing idle sleep is usually enough. macOS includes caffeinate; you can read its options in Terminal with man caffeinate.
caffeinate -i -t 3600This holds an idle-sleep assertion for one hour. Stop it earlier with Control-C. It does not provide a general override for lid-close sleep. The -s option applies only on AC power; it is not a battery-powered closed-lid solution.
If you need the lid closed without a monitor
Stay Awake's Keep Awake When Lid Closed mode is intended for this case. It changes a protected sleep setting through a helper that needs administrator approval once. The regular Keep Awake mode does not need that helper.
- Download the trial and move StayAwake into Applications.
- Open the cup menu and choose an auto-stop timer.
- Select Keep Awake When Lid Closed and approve the helper when prompted.
- Leave the Mac on a ventilated surface. Reopen the lid and check that your particular task continues as expected.
- Stop the mode from the cup menu when you finish.
The helper is designed to restore normal sleep if the app quits or crashes. Closed-lid mode also stops when macOS reports serious thermal pressure or battery charge falls below your selected level, 10% by default. These are backstops, not a guarantee against overheating.
Before leaving a task running
- Use a timer and a ventilated surface. Avoid enclosed bags.
- Check power, available storage, and the task's own timeout settings.
- Keeping the Mac awake cannot preserve a Wi-Fi connection that goes out of range or make a failed upload resume.
- Test the trial with your own Mac and workload before relying on it.
Which option should you choose?
For a desk setup with an external display, try Apple's built-in setup first. With the lid open, try caffeinate or a free menu bar utility. For closed-lid work without a display, compare the available tools and their requirements.