TY-teo

TY-teo / StayAwake

Public

Native macOS menu bar app that keeps your MacBook awake for AI coding agents - Claude Code, OpenAI Codex, Cursor - even with the lid closed. Open source (MIT), IOPMAssertion + scoped sudoers rule for password-free pmset, timed auto-off, login item, crash-safe self-heal. Built for overnight agent runs and clamshell mode without an external display.

16
0
89% credibility
Found Jun 01, 2026 at 16 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
Swift
AI Summary

StayAwake is a native macOS menu bar app that keeps your MacBook awake during long AI coding sessions, including allowing it to run with the lid closed for overnight agent tasks.

How It Works

1
💻 Your Mac falls asleep during an AI task

You start a long AI coding task before bed, but wake up to find your Mac asleep and your agent stuck on task three.

2
🔍 You discover StayAwake online

You search for a solution and find this tiny menu bar app designed specifically for keeping your Mac awake during AI agent runs.

3
📥 You download and install the app

You drag the app to your Applications folder and approve it in System Settings when prompted (first-time security check).

4
You enable Keep Awake

With one click in the menu bar, your Mac stops falling asleep when idle. You pick how long: 30 minutes, a few hours, or forever.

5
You close the lid and keep working
🔐
First time: quick admin approval

macOS asks for your password once to allow the lid-close feature.

Later: passwordless switching

You enable one-time passwordless access, so future lid-close toggles are silent.

6
🌙 You go to sleep while your Mac works

Your AI agent finishes all 40 tasks overnight. The timer auto-releases when done, or you wake up to a completed project.

🎉 Your AI agent ran to completion

No more half-finished overnight tasks. Your Mac stayed awake exactly as long as needed, then returned to normal.

Sign up to see the full architecture

5 more

Sign Up Free

Star Growth

See how this repo grew from 16 to 16 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is StayAwake?

StayAwake is a native macOS menu bar app that keeps your MacBook from sleeping during long AI agent runs. Built in Swift with SwiftUI, it handles two separate sleep prevention paths: standard idle sleep via IOPMAssertion, and lid-closed operation via pmset disablesleep. The app sits in your menu bar, offers a clean control panel in the native macOS Settings style, and can auto-shut off after 30, 60, 120, or 300 minutes. It also manages login item registration so it starts automatically.

Why is it gaining traction?

The AI coding agent era exposed a gap that older tools never addressed. Claude Code, Codex, and Cursor run for hours or overnight, but closing the lid puts the Mac to sleep within minutes. Existing solutions either stop idle sleep only (caffeinate, KeepingYouAwake) or require closed-source sandboxed apps (Amphetamine). StayAwake is the only open-source option that tackles both paths and ships a scoped sudoers rule so you authorize once, then toggle lid-close silently for overnight runs. The crash-safe self-heal is a thoughtful touch: if the app crashes while disablesleep is active, the next launch automatically restores it.

Who should use this?

Developers running Claude Code, OpenAI Codex, or Cursor on MacBooks without an external display. If you've been carrying a half-open laptop through airports or gyms to keep your agent alive, this solves that. Also useful for anyone running long overnight builds or CI tasks on a closed MacBook. Not for users who just need occasional idle prevention; caffeine or a menu bar toggle handles that fine.

Verdict

StayAwake fills a real gap for AI agent workflows on MacBooks, and the scoped sudoers approach is elegant. At 16 stars with a 0.9% credibility score, it's brand new and not notarized yet, so expect to bypass Gatekeeper on first launch. The codebase is clean Swift with tests, but maturity is early. Worth installing if you run agents with the lid closed; otherwise, simpler tools suffice.

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.