Your Mac goes to sleep when it thinks you have stopped using it. That is a problem during a long download, an export, a backup, a remote session, or an AI agent run.
This guide covers four ways to keep a Mac awake, how to do it with the lid closed, and how to keep a Mac awake for Claude Code and other AI agents.
Quick answer: how to keep your Mac awake
Fastest, built in: open Terminal and run caffeinate. The Mac stays awake until you press Control-C.
Free app with timers: Amphetamine from the Mac App Store.
No extra software: a sleep option in System Settings.
Shotbase is a comprehensive tool designed to capture and manage all your screen-based content effortlessly. With features like stunning screenshot capabilities, recording options that include cinematic effects, and an intuitive organizational structure powered by local AI, you can easily keep your multimedia assets organized and accessible. Shotbase not only allows you to capture specific areas, windows, or full screens on your Mac but also enables you to edit and enhance your captures with backgrounds, frames, and annotations. The integrated AI ensures your captures are automatically named and tagged for easy searching, making it an excellent choice for anyone looking to enhance their productivity and creativity in one seamless workspace.
SoftwareCreativemacOS
DeskMinder
For Easily Distracted Minds
Freemium
DeskMinder is a productivity software application designed for Mac users who struggle with distractions. It provides a straightforward interface for creating desktop pop-up reminders and tasks, helping users manage urgent to-dos, short breaks, and fleeting ideas. With features like full-screen notifications and Apple Reminders integration, DeskMinder aims to enhance focus and time management for i
- With features like easy-to-create desktop pop-ups for reminders and tasks, it simplifies the process of staying on top of urgent to-dos, short breaks, or fleeting ideas.
- Users can benefit from full-screen notifications, Apple Reminders integration, and flexible widget placement, making it ideal for anyone requiring a little extra help to maintain focus.
- The app includes additional shortcuts for quick reminder setups and customizable widget options, along with a history tracking feature to monitor daily progress.
Designed specifically for Mac users, DeskMinder aims to facilitate better time management and productivity for those with attention challenges, providing a seamless user experience without unnecessary complexity.
SoftwareProductivitymacOS
Klack
Satisfying sound with every keystroke
Paid
Klack is a macOS application designed to enhance the typing experience through high-fidelity sound for each keystroke. It provides features such as immersive spatial audio, instant feedback, and customizable sound options, making it suitable for writers, developers, and anyone who values an engaging typing environment. The app is easily accessible from the menubar and offers extensive configuratio
- Provides immersive spatial audio for enhanced typing feedback.
- Allows customization of keystroke sounds, pitch variations, and volume settings.
- Features a menubar interface for quick access to configuration options.
- Supports instant feedback with each keystroke for a more engaging experience.
- Designed for writers and developers seeking auditory feedback while typing.
Klack enhances the typing experience on Mac by providing high-fidelity sound for each keystroke.
SoftwaremacOS
TypoTab
TypoTab, the ultimate AI writing assistant for
Paid
TypoTab is a macOS application that functions as an AI-driven writing assistant. It enhances writing efficiency by providing tools for grammar correction, text rephrasing, and content generation, all accessible from the menu bar without needing to switch applications. This tool is designed for writers, students, and professionals looking to streamline their writing process and improve productivity
- Provides grammar correction and text rephrasing directly from the menu bar.
- Allows text refinement in any application without switching contexts.
- Offers customizable actions to meet individual writing needs.
- Streamlines repetitive writing tasks for improved efficiency.
- Supports a wide range of applications, enhancing workflow across platforms.
TypoTab is a macOS application that enhances writing efficiency by providing grammar correction, text rephrasing, and content generation directly from the menu bar. It allows users to refine text in any application without switching contexts, offering customizable actions to suit individual writing needs.
SoftwareProductivitymacOS
Mercury Weather
Local forecasts, radar, and live widgets
Freemium
Mercury Weather is a weather application providing local forecasts, live widgets, radar maps, and notifications. It offers detailed visualizations, daily and trip forecasts, and is available on iPhone, iPad, Mac, and Apple Watch.
- Provides beautiful weather charts and visualizations
- Includes detailed daily and trip forecasts
- Offers accurate rain forecasts and weather notifications
- Features hurricane and storm tracking tools
- Displays tide forecasts and radar maps
- Supports Apple Watch app and home or lock screen widgets
Mercury Weather is free to download with in-app purchases available. It requires devices running iOS 16.0 or later for Apple platforms.
SoftwareUtilitiesiOS & iPadOS
Quill
Mac Markdown editor with AI co-writers
Free
Quill is a free and open-source writing application for macOS 26 or later, combining a Markdown editor with built-in AI editing from multiple model co-writers. It lets users edit drafts by voice or text, with revisions made directly in place.
- Edits drafts in place using selected AI co-writers, such as Claude Code or Codex
- Supports voice or typed editing requests using keyboard shortcuts
- Offers multi-model editing by stacking responses from multiple AI agents for comparison
- Stores notes as plain .md files compatible with Obsidian
- Reads and applies user style rules from a Voice.md file before every edit
- Connect supported agent sign-ins or your own compatible API endpoint; provider charges and subscriptions are separate
Quill is available at no cost, distributed under the Apache 2.0 license, and requires macOS 26 or later. Users must have or set up supported AI agent accounts to enable co-writer editing capabilities.
SoftwareWritingmacOS
Linear Mobile
Product planning and issue tracking companion
Free
Linear Mobile is a purpose-built iOS app for planning and building products. It complements the Linear desktop app and enables users to streamline issues, projects, and product roadmaps when away from their main workstation.
- File product issues while on-the-go
- Stay updated on important work streams
- Receive instant notifications for key updates
- Update issues, projects, and documents remotely
Linear Mobile requires an existing Linear account to use. The app is available free of charge and supports iOS devices with at least iOS 18.0.
SoftwareProductivityiOS & iPadOS
Roadie
Automatic audio device switcher for Mac
One-time
Roadie is an automatic audio device switcher for macOS that selects your preferred microphone and speaker according to a ranked list. It maintains your chosen devices through reconnects and wake events.
- Automatically switches default input and output audio devices based on user-defined priority
- Maintains separate priority lists for microphones and speakers/headphones
- Supports Bluetooth, USB, and built-in audio devices recognized by macOS
- Operates without audio recording, processing, or microphone permission requirements
- Allows manual override and temporary pause of automatic switching
- Stores routing rules and device names locally, requiring no account creation
Roadie requires macOS 13 or later and runs on both Apple silicon and Intel Macs. A free 7-day trial is available; continued use requires a $9.99 one-time license, valid for up to three Macs, with lifetime updates.
SoftwareAudiomacOS
Magnet
Snap Mac windows into halves, thirds, and quarters.
One-time
Magnet is a long-running window manager for Mac that snaps windows into organized tiles. You drag a window to a screen edge or corner, use a keyboard shortcut, or pick a layout from the menu bar.
- Halves, thirds, quarters, and full screen layouts.
- Drag to edges and corners, or use customizable keyboard shortcuts.
- Custom commands and configurable layouts.
- Supports up to six external displays and vertical screens.
- Optional iCloud sync of settings.
Magnet is a one-time purchase on the Mac App Store with a perpetual license and no subscription.
SoftwareUtilitiesmacOS
Step 1: Open Terminal.
Step 2: Run caffeinate.
Step 3: Press Control-C when you want your Mac to sleep normally again.
You can also set a timer or attach it to a command. Apple's man page lists these options:
Command
What it does
caffeinate -t 3600
Stays awake for one hour (the timeout is in seconds)
caffeinate -d
Keeps the display from sleeping
caffeinate -i
Prevents idle sleep (the default)
caffeinate -s
Prevents system sleep, but only on AC power
caffeinate -i make
Stays awake only while the command runs
caffeinate -i -w PID
Stays awake until that process ID exits
Flags combine, for example caffeinate -dis. Use -m for the disk and -u to declare the user active.
Method 2: Keep your Mac awake with Amphetamine
Amphetamine is a free keep-awake app on the Mac App Store, with no ads or in-app purchases.
Click its menu bar icon to start a session. You can keep the Mac awake indefinitely, for a set time, until a set time, while a file downloads, or while a chosen app runs. Triggers can start a session automatically, for example when an external display is connected.
Uncheck Allow system sleep when display is closed to keep a closed MacBook running. Image: Amphetamine
AmphetamineFree menu bar app that keeps your Mac awake.Visit WebsiteAmphetamine is a free macOS menu bar app that keeps your Mac awake with manual sessions or automatic Triggers.
- Starts sessions indefinitely, for a set time, or while an app or file download runs.
- Creates Triggers based on displays, power, Wi-Fi, apps, and more.
- Can keep a MacBook awake while its lid is closed.
- Allows the display to sleep while the Mac stays awake.
- Has no ads and no in-app purchases.
Amphetamine is a long-standing free option for anyone who needs precise control over sleep on a Mac.Visit Website
Method 3: Stop your Mac from sleeping in System Settings
MacBook: open System Settings, click Battery, then Options, and turn on "Prevent automatic sleeping on power adapter when the display is off."
Mac mini, iMac, Mac Studio: open System Settings, click Energy, and turn on "Prevent automatic sleeping when the display is off."
Terminal option: run pmset -g custom to save your current settings, then sudo pmset -c sleep 0 to turn off system sleep on the charger. Set the value back to the number you saved to undo it.
The display can still turn off. Change that in Lock Screen settings.
Method 4: Keep your Mac awake with a menu bar app
Amphetamine is the free general choice. For AI coding agents, four apps keep the Mac awake only while an agent works: Agent Caffeine, Hold My Lid, Ajar, and the free, open-source Double Shot.
How to keep your Mac awake with the lid closed
Closing a MacBook lid is a separate sleep trigger. Your options:
Clamshell mode (free): connect power, an external display, and a keyboard and mouse, then close the lid. Our MacBook clamshell mode guide has the full setup.
Amphetamine: uncheck "Allow system sleep when display is closed" in a session. On Apple silicon, it asks you to install a helper script and approve it with admin authentication.
Agent-aware apps: Agent Caffeine, Hold My Lid, Ajar, and Double Shot keep a closed MacBook running without a display, even on battery.
The caffeinate command is not designed to override lid-close sleep, so do not rely on it with the lid shut.
Keep your Mac awake for Claude Code and AI agents
macOS sleeps when its idle timer runs out, and only keystrokes, mouse movement, or an app's power assertion reset it. Claude Code thinking and calling tools does not, so the Mac sleeps and the session drops.
How to keep Claude Code running with caffeinate
Start Claude Code through caffeinate: caffeinate -i claude. When Claude Code exits, the Mac can sleep again. Already running? Find its process ID with pgrep -f claude, then run caffeinate -i -w PID with that number.
Wrapping Claude Code with caffeinate, or attaching it to a running session. Illustration: Macfolio
An idle Claude Code session at a prompt still keeps the Mac awake.
Agent Caffeine vs Hold My Lid vs Ajar: best apps to keep a Mac awake for AI agents
Agent Caffeine
Hold My Lid
Ajar
Price
$19 once (1 Mac), $29 (3 Macs)
$9.99 early-bird, normally $14.99, up to 3 Macs
$10 for 3 Macs, $3 per extra Mac
Agent detection
40+ agents, per session
Hooks for Claude Code, Codex, OpenCode; process detection for others
Hooks for Claude Code, Codex, OpenCode, Gemini CLI
Lid closed on battery
Yes, after a one-time helper approval
Yes, no external display needed
Yes, built-in Lid Lowered rule
Agent Caffeine: keep your Mac awake for Claude Code and 40+ agents
Agent Caffeine tracks each session of Claude Code, Codex, Cursor, Gemini CLI, and more, so only a working session keeps the Mac awake.
Each working session and how long it has run. Image: Agent Caffeine
When an agent asks you something, it stays awake five minutes for your answer. It is $19 once after a 7-day trial.
Agent CaffeineKeep your Mac awake for agentsVisit WebsiteAgent Caffeine is a Mac menu bar utility that prevents sleep while AI coding agents are working, then allows the Mac to sleep when work stops.
- Track activity from agents including Claude Code, Codex, and Cursor.
- Keep the Mac awake with the lid closed during active work.
- Allow a configurable grace period when an agent waits for input.
- Send notifications when agents need attention or finish.
- Pause sleep prevention or stay reachable for a set duration.
Closed-lid operation on battery requires an approved helper. Battery and temperature safeguards can release sleep prevention. Includes a seven-day trial, followed by a one-time purchase with lifetime updates.Visit Website
Hold My Lid: keep Claude Code running with the lid closed
Hold My Lid reads Claude Code, Codex, and OpenCode hooks to know when each session is working. Cursor and Gemini CLI use process detection.
Battery, cut-off, and working agents in one menu. Image: Hold My Lid
It keeps a MacBook awake with the lid shut and no external display, and never reads your code.
Hold My LidClose your MacBook. Your agents keep running.Visit WebsiteHold My Lid is a macOS application designed to keep your Mac awake while coding agents like Claude Code and OpenAI Codex are active, even with the lid closed. This tool helps developers manage their workflow by allowing their laptops to remain operational while stored in a bag, ensuring that tasks are completed without interruption.
- Keeps your Mac awake while coding agents are active, even with the lid closed.
- Utilizes lifecycle hooks to accurately monitor agent activity and manage wake states.
- Configurable settings allow users to set battery thresholds and power modes.
- Provides notifications and sound alerts when agents complete tasks or battery limits are reached.
- Offers a menu-bar dropdown for quick access to status, agent sessions, and control options.
- Supports global shortcuts for toggling the app on or off from any application.
Hold My Lid is a macOS application designed to keep your Mac awake while coding agents operate, even with the lid closed. It offers a one-time purchase model, allowing use on up to three Macs without the need for subscriptions.Visit Website
Ajar: keep your Mac awake with agent and lid-angle rules
Ajar stays awake for each Claude Code, Codex, OpenCode, or Gemini CLI turn, with extra rules for apps, processes, Wi-Fi, disks, and power.
Ajar's Lid Lowered rule keeps the Mac awake at 60 degrees or less. Image: Parcse
AjarLid angle sync and keep-awake rulesVisit WebsiteAjar is a macOS utility designed to enhance user interaction with Mac devices. It features Lid Angle Sync, which automatically adjusts screen brightness, keyboard backlight, and volume based on the MacBook lid's position, accommodating external monitors with individual settings.
- Adjusts screen brightness, keyboard backlight, and volume based on MacBook lid angle.
- Supports per-display offsets for external monitors during lid adjustments.
- Prevents Mac from sleeping during active work with customizable rules.
- Built-in rules for specific applications like Claude Code, Codex, and Gemini CLI.
- Allows user-defined conditions based on apps, networks, external drives, and power sources.
Ajar provides practical solutions for users seeking to optimize their Mac experience. By automating adjustments based on the MacBook lid's position and allowing for customizable settings, it enhances productivity and user comfort.Visit Website
Double Shot: free, open-source app to keep your Mac awake for AI agents
Double Shot is a free, MIT-licensed menu bar app that stays awake while Claude Code, Codex, Gemini CLI, Cursor Agent, Copilot CLI, OpenCode, Amp, or Aider are working, not just open. You can also pick a timer from 15 minutes to 5 hours, or run it until you turn it off.
The panel with quick picks, Lid closed, and AI agents switches. Image: Double Shot
Lid closed mode needs a one-time setup. Double Shot asks for your password once and adds a sudoers rule so it can run pmset disablesleep without asking again. For heat, it stops at the first warm level with the lid closed, turns the dark display off, switches on Low Power Mode on battery, and lets go when the battery gets low (20% by default). It is not notarized by Apple yet, so a browser download needs Open Anyway in Privacy & Security, while Homebrew skips that step: brew install --cask noahelhadedy/tap/double-shot. It needs macOS 14 or later.
Double ShotFree open-source Mac app that keeps your Mac awake for AI agentsVisit WebsiteDouble Shot is a free, open-source macOS menu bar app that keeps your Mac awake, with the lid closed too, and for as long as your AI coding agents are working.
- Detects when Claude Code, Codex, Gemini CLI, Cursor Agent, Copilot CLI, OpenCode, Amp or Aider are actually working, not just open.
- Lid closed mode uses pmset disablesleep, with a one-time password prompt that adds a sudoers rule.
- Stops at the first warm level, turns the dark display off, switches on Low Power Mode on battery, and lets go when the battery gets low.
- Quick picks from 15 minutes to 5 hours, or until you turn it off.
- MIT licensed. Install with Homebrew or download from GitHub. Not notarized by Apple yet, and it needs macOS 14 or later.
Double Shot suits anyone who starts a long agent run, closes the lid and expects the work to carry on.Visit Website
What to check before running an agent with the lid closed
Power and heat. Clamshell mode needs power, an external display, and a keyboard and mouse. Use a stable surface with good airflow, and never run a closed MacBook in a bag.
Battery cut-off. Agent Caffeine sleeps at 20%; Hold My Lid's cut-off is configurable; Double Shot stops at 20% on battery by default.
Permission prompts. A Claude Code approval prompt pauses the agent. Pre-approve safe commands with permissions.allow, and accept macOS helper prompts before closing the lid.
Amphetamine. It works with agents, but its Triggers cannot tell a working agent from an idle one.
On battery with the lid closed, Agent Caffeine asks once for a helper and sleeps at 20%. Image: Agent Caffeine
How to check what is keeping your Mac awake
Run pmset -g assertions in Terminal and look for PreventUserIdleSystemSleep set to 1.
Checking which process keeps the Mac awake (abridged output). Illustration: Macfolio
FAQ
How do I keep my Mac awake?
Run caffeinate in Terminal, install Amphetamine, or change the sleep option in Battery or Energy settings.
What does caffeinate do on a Mac?
It prevents sleep while it runs. With no options it prevents idle sleep, and flags cover the display, disk, system, and user activity.
Is Amphetamine free?
Yes. Amphetamine is free on the Mac App Store, with no ads, in-app purchases, or pro version.
How do I keep my MacBook awake with the lid closed?
Use clamshell mode, or an app with closed-lid support such as Amphetamine, Agent Caffeine, Hold My Lid, Ajar, or Double Shot.
How do I keep my Mac awake while Claude Code runs?
Start it with caffeinate -i claude. For automatic control, use Agent Caffeine, Hold My Lid, Ajar, or the free, open-source Double Shot.
Can my Mac keep running Claude Code with the lid closed?
Yes, with the right setup. Clamshell mode works on power with an external display. Without one, apps like Double Shot, Agent Caffeine, Hold My Lid, and Ajar can hold the Mac awake, and Double Shot needs a one-time password for lid closed mode. Never run a closed MacBook in a bag unless the app has heat and battery limits.
How do I stop my Mac from sleeping on the charger?
Turn on "Prevent automatic sleeping on power adapter when the display is off" in Battery, Options.
Verdict: the best way to keep a Mac awake
For a quick job, caffeinate is enough. For timers and a menu bar switch, use Amphetamine. For all-day AI agent work, Agent Caffeine is the most complete, Hold My Lid is the best value, and Ajar suits rules beyond agents. If you want a free, open-source option, try Double Shot.
A low-profile 96% mechanical keyboard with a number pad and three connection options.
HardwareKeyboards & MicemacOS
Mercury Weather
Local forecasts, radar, and live widgets
Freemium
Mercury Weather is a weather application providing local forecasts, live widgets, radar maps, and notifications. It offers detailed visualizations, daily and trip forecasts, and is available on iPhone, iPad, Mac, and Apple Watch.
- Provides beautiful weather charts and visualizations
- Includes detailed daily and trip forecasts
- Offers accurate rain forecasts and weather notifications
- Features hurricane and storm tracking tools
- Displays tide forecasts and radar maps
- Supports Apple Watch app and home or lock screen widgets
Mercury Weather is free to download with in-app purchases available. It requires devices running iOS 16.0 or later for Apple platforms.
SoftwareUtilitiesiOS & iPadOS
Quill
Mac Markdown editor with AI co-writers
Free
Quill is a free and open-source writing application for macOS 26 or later, combining a Markdown editor with built-in AI editing from multiple model co-writers. It lets users edit drafts by voice or text, with revisions made directly in place.
- Edits drafts in place using selected AI co-writers, such as Claude Code or Codex
- Supports voice or typed editing requests using keyboard shortcuts
- Offers multi-model editing by stacking responses from multiple AI agents for comparison
- Stores notes as plain .md files compatible with Obsidian
- Reads and applies user style rules from a Voice.md file before every edit
- Connect supported agent sign-ins or your own compatible API endpoint; provider charges and subscriptions are separate
Quill is available at no cost, distributed under the Apache 2.0 license, and requires macOS 26 or later. Users must have or set up supported AI agent accounts to enable co-writer editing capabilities.
SoftwareWritingmacOS
Linear Mobile
Product planning and issue tracking companion
Free
Linear Mobile is a purpose-built iOS app for planning and building products. It complements the Linear desktop app and enables users to streamline issues, projects, and product roadmaps when away from their main workstation.
- File product issues while on-the-go
- Stay updated on important work streams
- Receive instant notifications for key updates
- Update issues, projects, and documents remotely
Linear Mobile requires an existing Linear account to use. The app is available free of charge and supports iOS devices with at least iOS 18.0.
SoftwareProductivityiOS & iPadOS
Roadie
Automatic audio device switcher for Mac
One-time
Roadie is an automatic audio device switcher for macOS that selects your preferred microphone and speaker according to a ranked list. It maintains your chosen devices through reconnects and wake events.
- Automatically switches default input and output audio devices based on user-defined priority
- Maintains separate priority lists for microphones and speakers/headphones
- Supports Bluetooth, USB, and built-in audio devices recognized by macOS
- Operates without audio recording, processing, or microphone permission requirements
- Allows manual override and temporary pause of automatic switching
- Stores routing rules and device names locally, requiring no account creation
Roadie requires macOS 13 or later and runs on both Apple silicon and Intel Macs. A free 7-day trial is available; continued use requires a $9.99 one-time license, valid for up to three Macs, with lifetime updates.
SoftwareAudiomacOS
S6 Mini Subwoofer
A compact powered subwoofer for adding bass to a Mac speaker setup.
HardwareAudiomacOS
M6 Silent
A quiet wireless mouse with a metal scroll wheel and customizable Mac controls.
HardwareKeyboards & MicemacOS
Magic Mouse (USB-C)
Apple's wireless Multi-Touch mouse with USB-C charging.
HardwareKeyboards & MicemacOS
MX Anywhere 3S for Mac
A compact Mac mouse with quiet clicks, 8K DPI tracking, and a MagSpeed wheel.