Skip to content

Repository files navigation

Sleep Scheduler

Sleep Scheduler is a small macOS menu bar app that puts your Mac to sleep and wakes it back up on a weekly schedule.

It is built for always-on Macs that do not need to run all night, such as a Mac mini on a desk, in a home lab, or tucked away as a lightweight server.

Sleep Scheduler menu bar popover

Features

  • Per-weekday sleep and wake times
  • Menu bar only, with no Dock icon
  • One-click pause/resume
  • Current pmset schedule preview
  • Plain-text event log for launch, sleep, wake, schedule, and clear events
  • Native macOS sleep/wake scheduling through pmset
  • Automatic replanning on launch, wake, and schedule changes

How It Works

Sleep Scheduler uses macOS's built-in pmset utility.

When scheduling is active, the app reads your weekly settings, calculates the next sleep/wake window, and installs the appropriate system power event. If every enabled day uses the same times, it uses a repeating pmset schedule. If days differ, it installs the next one-shot pair and rolls the schedule forward after the Mac wakes.

Because changing pmset schedules requires administrator privileges, macOS may ask for your password when the app installs or clears scheduled events.

Requirements

  • macOS 13 or later
  • Administrator access when installing or clearing system sleep/wake schedules
  • Xcode 15 or later if you want to build from source

Setup

Download the App

The fastest way to try Sleep Scheduler is to download the built DMG from this repository:

Download SleepScheduler.dmg

  1. Open SleepScheduler.dmg.
  2. Drag SleepScheduler.app into Applications.
  3. Open Sleep Scheduler from Applications.
  4. Look for the moon icon in the macOS menu bar.

This DMG is built locally from the repository and is not notarized yet. On first launch, macOS may ask you to confirm that you want to open it.

Build From Source

  1. Open SleepScheduler.xcodeproj in Xcode.
  2. Select the SleepScheduler target.
  3. In Signing & Capabilities, choose your development team.
  4. Build and run with Cmd+R.
  5. Look for the moon icon in the macOS menu bar.

You can also build, install, and launch a Release copy with:

./run.sh

The helper script installs the app to:

~/Applications/SleepScheduler.app

First Run

  1. Click the moon icon in the menu bar.
  2. Set sleep and wake times for each weekday.
  3. Uncheck any day you want to leave unscheduled.
  4. Turn the main toggle on.
  5. Approve the macOS administrator prompt when scheduling is installed.

The "Current system schedule" section shows the output of:

pmset -g sched

Event Log

Sleep Scheduler writes an append-only text log to:

~/Library/Logs/SleepScheduler/events.log

Example:

TIMESTAMP            EVENT      DETAIL
-------------------  ---------  ------------------------------------------------------------
2026-04-23 22:59:57  SCHEDULED  sleep=04/23/26 23:00:00  wake=04/24/26 05:00:00
2026-04-23 23:00:02  SLEEP      System going to sleep
2026-04-24 05:00:14  WAKE       System woke up

The app includes buttons to reveal the log in Finder or open it in your default editor.

Important Caveats

  • Sleep Scheduler clears global pmset schedules. Before installing its own schedule, the app runs pmset repeat cancel and pmset schedule cancelall. If another tool manages scheduled power events, those events may be removed.
  • Sleep is not shutdown. The app uses system sleep, not full shutdown. Power draw drops significantly, but the Mac remains resumable.
  • Wake depends on macOS and power state. Scheduled wake works best on AC power and can be affected by system settings, hardware support, or macOS power-management behavior.
  • Administrator prompts are expected. A future version could use a privileged helper, but this version intentionally keeps the implementation simple and transparent.

Removing Scheduled Events

Turn the main toggle off in the menu. Sleep Scheduler will clear scheduled power events.

To verify manually:

pmset -g sched

To clear scheduled power events yourself:

sudo pmset repeat cancel
sudo pmset schedule cancelall

Project Structure

  • SleepSchedulerApp.swift: app lifecycle, menu bar status item, popover, sleep/wake observers, and force-sleep timer
  • MenuBarContentView.swift: SwiftUI menu UI
  • ScheduleStore.swift: persistent weekly schedule state in UserDefaults
  • Scheduler.swift: planning logic and pmset integration
  • EventLog.swift: append-only event log
  • SleepSchedulerTests: planner tests

Development

Run tests with:

xcodebuild -project SleepScheduler.xcodeproj -scheme SleepScheduler -destination 'platform=macOS' test

Build locally with:

xcodebuild -project SleepScheduler.xcodeproj -scheme SleepScheduler -destination 'platform=macOS' build

About

A minimal menu bar app for macOS that puts your Mac to sleep on a per-weekday schedule and wakes it back up, so your Mac mini isn't running hot during hours you don't need it.

Resources

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages