Home / Problems / Keep a Mac awake while Claude Code runs

Workflow problem

Keep a Mac awake while Claude Code runs

A long local Claude Code task can stop when macOS sleeps or the terminal loses power. Keep the host awake for the duration of the job and retain a way to see its progress.

The problem

A long local Claude Code task can stop when macOS sleeps or the terminal loses power. Keep the host awake for the duration of the job and retain a way to see its progress.

Native approach

On macOS, run `caffeinate -i claude` for a foreground session. Keep the terminal open; `caffeinate` prevents idle sleep while the command runs. This is a macOS command, not a Claude Code setting.

Official Claude Code documentation ↗

Tools to consider

Use a monitor when you need status away from the desk; remote access does not itself prevent macOS sleep.

FAQ

Will a remote dashboard prevent sleep?

No. Keep the Mac awake separately with macOS power settings or `caffeinate`.

Can I close the terminal?

A foreground Claude Code process depends on its terminal. Use a persistent terminal session if you need to detach.