---
title: "Keep your Mac awake: prevent it from sleeping while plugged in, downloading or running agents"
url: "https://kilobat.app/keep-mac-awake"
description: "Kilobat Awake keeps a Mac from sleeping while it is plugged in, while a download finishes, while AI agents work or for a set time, then lets it sleep again."
---

Keep awake

# Keep the Mac awake only as long as the job needs.

Kilobat Awake stops your Mac from sleeping while it is plugged in, while a download runs, while an AI agent works or for a time you pick. When the job ends, the Mac sleeps as usual. It is free in the app and the CLI.

[Download for Mac ↓](https://kilobat.app/downloads/Kilobat-1.44.2.dmg?via=site)

```
brew install seifip/kilobat/kilobat
```

**Keep this Mac awake**Awake · 1 h 12 min left

Until downloads finishWhile plugged inWhile AI agents workKeep the screen on

## Sound familiar?

- “I left a download running and came back to a sleeping Mac.”
- “The agent stopped when I walked away.”
- “I do not want it awake all night, only until the job ends.”
- “I need the screen on while I present.”

How long

## Pick a time, or let the job decide.

Click the teacup in the Kilobat popover. The **Keep this Mac awake** panel shows how long the Mac stays awake and what is holding it.

- **For a number of hours.** A timer counts down, then the Mac sleeps again.
- **Until I turn it off.** The panel shows how long the Mac has been awake.
- **Until downloads finish.** The Mac stays awake while the traffic runs. It sleeps after 3 minutes of quiet by default.
- **While an app is in front.** Pick an open app, for reading or presenting. Switching away lets the Mac sleep.

Turn off from the same panel at any time. See the guide for [a Mac that sleeps and stops downloads](https://kilobat.app/guides/mac-sleep-stops-downloads).

**Until downloads finish**Sleeps after 3 min of quiet**While an app is in front**Sleeps when you switch away

Automatic rules

## Let rules start it for you.

The **Automatically** section of the panel holds rules. Each one starts an awake session when its condition is true.

- **While plugged in.** From plugging in until you unplug. Closing the lid still sleeps the Mac.
- **While AI agents work.** The Mac stays awake only while an agent talks to its service.
- **While an agent waits for you.** This needs the agent’s hooks. Without them, the Mac may sleep until you answer.
- **Keep the screen on.** This applies to everything Kilobat keeps awake. Without it, the screen sleeps while the Mac keeps working.

Set up the agent side in [Set up Kilobat in your agent](https://kilobat.app/agents). Each session lands in History with the data moved and the battery used.

AUTOMATICALLYWhile plugged in
From plugging in until you unplugWhile AI agents work
Only while an agent talks to its service

Terminal

## The same, from the CLI.

The CLI does the same without the menu bar. `kilobat awake -- <command>` keeps the Mac awake while one command runs, then reports the data it moved.

Terminal

```
# Awake for two hours
$ kilobat awake --for 2h
# Awake until downloads go quiet
$ kilobat awake --until-quiet
# Awake while one command runs
$ kilobat awake -- make release
```

Prefer the built-in tool? `caffeinate -i` does the basic job and costs nothing. See [caffeinate on Mac](https://kilobat.app/guides/caffeinate-keep-mac-awake).

Awake sessions and agent runs also appear in `kilobat sessions`.

Lid closed

## Closing the lid still sleeps the Mac.

Awake keeps a Mac from idle sleep. A closed lid on a laptop still puts it to sleep. To keep working agent runs going with the lid shut, turn on **Settings › Calls, streaming & Awake › Allow running with the lid closed**. This installs a small helper that you approve in System Settings.

- Set a battery level at which the Mac sleeps: 10, 20, 30 or 50%.
- Choose to run only on the power adapter.
- Set the longest time with the lid closed: 1, 2, 4 or 8 hours.

See [a Mac with the lid closed](https://kilobat.app/guides/clamshell-lid-closed-mac).

**With the lid closed too**
Within the limits in Settings

## Questions

**How do I stop my Mac from sleeping?**

Click the teacup in Kilobat’s popover and pick a time or **Until I turn it off**. Or run `kilobat awake` in Terminal. Kilobat lets the Mac sleep when the session ends.

**Can Kilobat keep my Mac awake only while it is plugged in?**

Yes. Turn on **While plugged in**. The Mac stays awake from plugging in until you unplug. Closing the lid still sleeps it.

**How does Until downloads finish know the download is done?**

It watches the Mac’s traffic. It lets the Mac sleep after 3 minutes of quiet by default. The CLI treats traffic below 16 KB/s as quiet.

**Does it work with AI agents?**

Yes. With **While AI agents work** on, the Mac stays awake while an agent talks to its service. To tell waiting for you from finished, connect the agent’s hooks.

**Does it keep the screen on?**

Only if you turn on **Keep the screen on**. Otherwise the screen sleeps while the Mac keeps working.

**Is there a free built-in option?**

Yes. The `caffeinate` command is part of macOS. It holds the Mac awake from Terminal and has no menu. See [caffeinate on Mac](https://kilobat.app/guides/caffeinate-keep-mac-awake). Kilobat adds the menu bar switch, rules and the record in History.

**Is it free?**

Keeping the Mac awake is free in the app and the CLI.

## Kilobat for…

[**Agent network log**Every host Claude Code, Codex or Cursor and its npm and curl contacted.](https://kilobat.app/ai-coding-agents)[**Bandwidth by app**Live upload and download for every app, in the menu bar.](https://kilobat.app/mac-bandwidth-monitor)[**Slow internet**Wi-Fi, router, provider or DNS: find the weak link.](https://kilobat.app/slow-internet-mac)[**Hotspot data**Keep backups and updaters off your phone’s data plan.](https://kilobat.app/save-hotspot-data)

## Awake until it is done, then asleep.

[Download for Mac ↓](https://kilobat.app/downloads/Kilobat-1.44.2.dmg?via=site)

```
brew install seifip/kilobat/kilobat
```
