← Blog Mac Productivity

How to Keep Your Mac Awake: 5 Ways to Prevent Sleep in 2026

By Akash Rajagopal ·

How to Keep Your Mac Awake: 5 Ways to Prevent Sleep in 2026

Whether you are running a long deployment, downloading a massive dataset, or need to stay active on communication tools during a build, Mac sleep can be a disruptive interruption. Here are five methods to keep your Mac awake, ranked from simplest to most capable.

What Is the Easiest Way to Prevent Mac Sleep?

The easiest method is changing your Energy settings in System Settings, which takes about 30 seconds and requires no downloads. Navigate to System Settings > Displays > Advanced and adjust “Prevent automatic sleeping when the display is off.” For a temporary solution, the caffeinate terminal command is even faster — a single line keeps your Mac awake for a set duration with zero configuration.

However, both of these methods have limitations that dedicated apps solve better.

Method 1: How Do You Change Mac Sleep Settings in System Settings?

Open System Settings > Lock Screen and set “Turn display off” to a longer duration or Never. Then go to Energy (or Battery for laptops) and disable “Put hard disks to sleep when possible.” On MacBooks, you will find separate settings for battery and power adapter.

Steps:

  1. Open System Settings > Lock Screen
  2. Set “Turn display off when inactive” to Never (or your preferred duration)
  3. Go to Energy (desktop) or Battery > Options (laptop)
  4. Toggle off “Put hard disks to sleep when possible”
  5. On laptops: enable “Prevent automatic sleeping when the display is off and the power adapter is connected”

Pros: Built-in, no downloads, persists across restarts. Cons: Permanent setting — easy to forget you changed it. No way to schedule or toggle quickly. Affects battery life on laptops if left on battery power.

Method 2: How Do You Use the Caffeinate Command in Terminal?

The caffeinate command is a built-in macOS utility that prevents sleep from the terminal. It uses the same IOKit power assertions that apps use, but requires no installation. According to Apple’s developer documentation, caffeinate can assert against display sleep, idle sleep, disk sleep, and system sleep independently.

Basic usage:

# Keep Mac awake indefinitely (Ctrl+C to stop)
caffeinate

# Keep awake for 2 hours (7200 seconds)
caffeinate -t 7200

# Keep awake while a process runs
caffeinate -w $(pgrep -f "your-process-name")

# Prevent display sleep specifically
caffeinate -d

# Prevent idle sleep (allows display to sleep)
caffeinate -i

# Combine flags: prevent display and idle sleep for 1 hour
caffeinate -di -t 3600

Flag reference:

FlagEffect
-dPrevent display sleep
-iPrevent idle sleep
-mPrevent disk sleep
-sPrevent system sleep (AC power only)
-t NTimeout after N seconds
-w PIDStay awake while process PID is running

Pros: Built-in, no downloads, very flexible, scriptable, no admin access needed. Cons: Requires an open terminal window. No visual indicator. Easy to forget it is running. Does not generate mouse activity for app-level idle detection.

Method 3: How Does Amphetamine Keep Your Mac Awake?

Amphetamine is a free menu bar app that prevents sleep with point-and-click simplicity. It has been one of the most popular keep-alive apps on the Mac App Store since 2014, with over 300,000 downloads. It supports triggers — automatic activation based on Wi-Fi network, app running, battery level, or time of day.

Pros: Free, feature-rich, trigger-based automation, well-maintained. Cons: Complex UI for a simple task. No mouse movement feature for app-level idle detection. Only prevents sleep — does not help with Slack/Teams activity status.

Method 4: What Is KeepingYouAwake and How Does It Work?

KeepingYouAwake is a free, open-source menu bar app that wraps the caffeinate command in a clean one-click interface. Click the coffee cup icon to toggle sleep prevention on and off. It supports preset durations (30 min, 1 hour, 2 hours, 5 hours) and activating at login.

Pros: Free, open-source, minimal and clean, low resource usage. Cons: Very basic — no triggers, no scheduling, no mouse movement. Only wraps caffeinate with no additional functionality beyond the GUI.

Method 5: How Does FavTray’s Move Mouse Feature Prevent Sleep?

FavTray’s Move Mouse feature takes a different approach by generating subtle, periodic mouse movements instead of just asserting power management flags. This keeps your Mac awake at the OS level while also maintaining active status in applications like Slack, Microsoft Teams, and Zoom that have their own idle detection based on input events.

The mouse movements are small (a few pixels) and infrequent enough to be unnoticeable during normal work, but sufficient to reset idle timers across the system. You can toggle it from the FavTray menu bar icon alongside the app’s other features — eye rest timer and AI usage tracking.

Pros: Prevents both OS sleep and app-level idle timeout. Bundled with other developer utilities in a single menu bar icon. Local-first with no data collection. Quick toggle from menu bar. Cons: Mouse movement approach means your cursor shifts slightly. Paid feature in the Pro tier.

Which Method Should You Choose?

MethodPrevents OS SleepPrevents App IdleVisual ToggleSchedulingCost
System SettingsYesNoNoNoFree
caffeinateYesNoNoDuration onlyFree
AmphetamineYesNoYesYes (triggers)Free
KeepingYouAwakeYesNoYesDuration onlyFree
FavTray Move MouseYesYesYesYesFree / Pro

For a deeper comparison of the dedicated apps, see our Mac keep alive app comparison.

Choose System Settings if you always want your Mac awake on AC power and do not care about per-session control.

Choose caffeinate if you are comfortable in the terminal and want a quick, scriptable solution for occasional use.

Choose Amphetamine if you want trigger-based automation — for example, automatically preventing sleep when connected to your office Wi-Fi.

Choose KeepingYouAwake if you want the simplest possible GUI with zero learning curve.

Choose FavTray if you need to stay active in Slack/Teams, want keep-alive bundled with an eye rest timer and AI tracking, or want to reduce your total menu bar app count.

How Do You Stop Your VPN from Disconnecting When Your Mac Sleeps?

VPN disconnections during Mac sleep are one of the most common complaints among remote workers, especially those using enterprise clients like Cisco AnyConnect, Palo Alto GlobalProtect, or Pulse Secure. The root cause is straightforward: when macOS enters sleep mode, it powers down network interfaces to conserve energy. Once the Wi-Fi or Ethernet adapter goes offline, your VPN tunnel collapses and has to renegotiate from scratch when the Mac wakes up — often requiring re-authentication.

The caffeinate -s flag prevents system sleep while on AC power, which keeps network interfaces alive. However, -s alone does not prevent idle sleep when running on battery, and it does not generate any input activity. If your corporate VPN client or endpoint management software has its own idle timeout independent of macOS sleep, caffeinate will not help.

FavTray’s Move Mouse feature solves both layers of the problem. It prevents macOS from sleeping by generating periodic input events, which keeps network interfaces powered on and VPN tunnels stable. At the same time, the simulated mouse activity satisfies any app-level idle detection your VPN client or IT management tool might enforce. For developers on corporate laptops where installing arbitrary software requires IT approval, note that FavTray does not require admin privileges — it uses standard macOS input APIs that operate at the user level.

If you are troubleshooting persistent VPN drops, check whether your IT department has configured a separate inactivity timeout on the VPN gateway itself. No client-side keep-alive tool can override a server-side session timeout — you will need your network admin to adjust that policy.

Can You Keep a MacBook Awake in Clamshell Mode with the Lid Closed?

Clamshell mode lets you use your MacBook with the lid closed, driving an external display while the internal screen is off. Apple’s official requirements are specific: you need a power adapter connected, an external display attached, and an external keyboard or mouse paired. When all three conditions are met, closing the lid keeps the MacBook awake instead of putting it to sleep.

The confusion arises when people try to run clamshell mode without an external display — for example, to let a long build or download finish with the lid closed. Without a display connected, macOS will sleep the MacBook immediately when the lid closes, regardless of power adapter state. This is a hardware-level behavior tied to the lid sensor, and no System Settings toggle overrides it.

The caffeinate command can technically prevent sleep after lid close if you start it before closing the lid and have a power adapter connected, but this is unreliable and Apple does not officially support it. Battery drain is a real concern since the system stays fully powered with no display output providing visual feedback.

FavTray’s Keep Alive feature works in clamshell mode when your MacBook is connected to power and an external display. The mouse movement continues generating input events, which prevents both macOS idle sleep and app-level idle timeouts — useful for docking station setups where you walk away from your desk but need Slack or Teams to show you as active. If you use a Thunderbolt dock with power delivery, your MacBook charges, drives the display, and stays awake with a single cable connection — the most streamlined setup for clamshell workflows.

Can You Prevent Sleep on a Schedule?

Yes. For scheduled prevention, you can combine caffeinate with cron or launchd, or use Amphetamine’s trigger system. For example, to prevent sleep every weekday from 9 AM to 6 PM, create a LaunchAgent plist that runs caffeinate -t 32400 at 9 AM.

FavTray lets you toggle Move Mouse on and off manually from the menu bar, which most developers prefer over automated schedules since the need for keep-alive is usually tied to specific tasks rather than clock time.

The right approach depends on your workflow. Most developers find that a quick toggle — whether through a menu bar app or a terminal alias — covers 90% of their keep-alive needs without the complexity of scheduled automation.

Frequently Asked Questions

Does keeping your Mac awake damage the battery?

Keeping your Mac awake does not damage the battery directly, but it does consume more power. Modern MacBooks use lithium-ion batteries with built-in charge management. The main concern is heat — if your Mac runs intensive tasks while preventing sleep, sustained heat can degrade battery health over time. For overnight processes, keep your Mac plugged in.

Can you keep your Mac awake without admin access?

Yes. The caffeinate terminal command works without admin privileges. Third-party apps like FavTray and KeepingYouAwake also work without admin access because they use the same IOKit power assertions that caffeinate uses, which do not require elevated permissions.

Does preventing Mac sleep keep you active on Slack and Teams?

Preventing sleep keeps your Mac from entering sleep mode, which keeps Slack and Microsoft Teams in an active state. However, some apps have their own idle detection that checks for keyboard and mouse input separately. FavTray's Move Mouse feature solves this by generating subtle mouse movements that satisfy both OS-level and app-level activity detection.

How do I keep my Mac awake with the lid closed?

Connect your MacBook to an external display, power source, and a keyboard or mouse. macOS enables clamshell mode automatically when these conditions are met. No third-party app can override the lid-close sleep behavior without an external display connected — this is a hardware-level safety feature.

How do I stop my VPN from disconnecting when my Mac sleeps?

Use a keep-alive tool like FavTray or the caffeinate -s command to prevent system sleep. VPN clients like Cisco AnyConnect and GlobalProtect disconnect because macOS disables network interfaces during sleep. Keeping the system awake keeps VPN connections alive.

Can I keep my MacBook awake with the lid closed?

Yes, in clamshell mode. Connect your MacBook to power and an external display, then close the lid. macOS will keep it awake. For builds or downloads without an external display, use caffeinate or FavTray's Keep Alive feature while connected to power.

FavTray is coming soon

Join the waitlist and we'll notify you when we launch.

No spam. Unsubscribe anytime.