sleep-guard

Toggle pmset disablesleep on macOS laptops to prevent sleep with the lid closed.

1|Updated Jan 22, 2022
One-click install
npx skills add https://github.com/gotomts/dotfiles --skill sleep-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sleep-guard
Source: https://github.com/gotomts/dotfiles/tree/main/claude/skills/sleep-guard
Command: npx skills add https://github.com/gotomts/dotfiles --skill sleep-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents a macOS laptop from sleeping when the lid is closed so long-running processes such as Claude Code continue to run and do not get interrupted by system sleep.

Core Features & Use Cases

  • State Inspection: Check current pmset SleepDisabled status to decide whether action is needed.
  • Enable / Disable Sleep: Safely toggle pmset disablesleep on or off using sudo with basic validation to avoid redundant changes.
  • Safety Checks & Warnings: Detects if the machine is running on battery and warns about heat and battery drain when disabling sleep; reminds users to re-enable sleep when finished.

Quick Start

Enable sleep prevention by running the skill with the on argument to disable sleep while the lid is closed and run it with off to restore normal sleep behavior.

Frequently Asked Questions about sleep-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent my Mac from sleeping when the lid is closed?

Toggle the pmset disablesleep setting on to prevent your Mac from sleeping with the lid closed, allowing long-running background processes to remain active during closed-lid operation.

How do I check if pmset sleep is currently disabled on macOS?

Run the sleep-guard skill with the state action to inspect the current pmset SleepDisabled status, verifying whether power management sleep prevention is already active on your macOS system.

Can I keep long-running development tasks active on a Mac laptop with the lid closed?

Apply the pmset disablesleep command via sudo to override default macOS power management behavior, keeping long-running development tasks active on your Mac laptop with the lid closed.

What happens if I disable Mac sleep while running on battery power?

The sleep-guard skill warns about potential heat buildup and battery drain when disabling Mac sleep on battery power, and it reminds you to re-enable normal sleep behavior once your background tasks are finished.

How do I restore normal sleep behavior on macOS after disabling it?

Run the sleep-guard skill with the off argument to toggle the pmset disablesleep setting back off using sudo, re-enabling standard macOS lid-close sleep functionality and restoring normal power management.