TreeMap
A free, open-source disk-space visualizer. Squarified treemap, duplicate hunting, disk-full forecasting, and cleanup that only ever moves files to the Trash.
Keep your Mac awake so your AI agents can finish the job. Free, source on GitHub, macOS.
ProductivityHTML · SwiftGitHub @coreyhaines31OnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
Keep your Mac awake. An open-source, actively maintained replacement for Amphetamine.
Taken from the repository README
Loading the full README. The saved excerpt is shown below.
Keep your Mac awake. A free, source-available, actively maintained replacement for Amphetamine.
Midnight Oil lives in your menu bar. Click the lamp, pick how long, and your Mac stays awake. It's built for people who liked Amphetamine and want something that's still being worked on.Read the full README ↗Midnight Oil lives in your menu bar as a small flame. Click it, pick how long, and your Mac stays awake: overnight while Claude Code, Codex, or Cursor works through a task, until a download finishes, or with the lid closed in your bag. When the session ends, your Mac goes back to its normal sleep settings on its own.
Requires macOS 14 Sonoma or later, on Apple silicon or Intel.
Homebrew
brew install --cask coreyhaines31/tap/midnightoil
Or download it
MidnightOil-x.y.z.dmg from the latest release.The app is signed and notarized by Apple, so it opens without warnings, and it updates itself.
Or ask your AI agent
Paste this into Claude Code, Codex, Cursor, or any agent with a terminal:
Install Midnight Oil, a free macOS menu bar app that keeps my Mac awake (https://github.com/coreyhaines31/midnightoil):
1. Check this Mac runs macOS 14 or later with `sw_vers -productVersion`. Stop and tell me if it doesn't.
2. If Homebrew is installed (`command -v brew`), run `brew install --cask coreyhaines31/tap/midnightoil`.
3. Otherwise, download the latest release and copy it to Applications:
url=$(curl -fsSL https://api.github.com/repos/coreyhaines31/midnightoil/releases/latest | grep -o 'https://[^"]*\.dmg' | head -1)
curl -fsSL -o /tmp/MidnightOil.dmg "$url"
mnt=$(hdiutil attach -nobrowse -readonly /tmp/MidnightOil.dmg | grep -o '/Volumes/.*' | tail -1)
cp -R "$mnt/Midnight Oil.app" /Applications/ && hdiutil detach -quiet "$mnt" && rm /tmp/MidnightOil.dmg
4. Run `open -a "Midnight Oil"`, then confirm it's running with `pgrep -x "Midnight Oil"`.
5. Tell me to look for the flame icon in my menu bar, that closed-lid mode needs a one-time approval in Settings › Closed Lid, and that from now on I can just ask you to keep my Mac awake. You'll do it with the `midnightoil` command (see `midnightoil --help`; if it isn't on the PATH, it's at "/Applications/Midnight Oil.app/Contents/MacOS/midnightoil").
Without Homebrew, from Terminal
url=$(curl -fsSL https://api.github.com/repos/coreyhaines31/midnightoil/releases/latest | grep -o 'https://[^"]*\.dmg' | head -1)
curl -fsSL -o /tmp/MidnightOil.dmg "$url"
mnt=$(hdiutil attach -nobrowse -readonly /tmp/MidnightOil.dmg | grep -o '/Volumes/.*' | tail -1)
cp -R "$mnt/Midnight Oil.app" /Applications/
hdiutil detach -quiet "$mnt" && rm /tmp/MidnightOil.dmg
open -a "Midnight Oil"
Midnight Oil has no Dock icon and no window. After you open it, look for the flame in the menu bar, near the clock.
Don't see it? On a MacBook with a notch, a crowded menu bar can hide icons behind the notch. Quit an app you don't need in the menu bar, or hold ⌘ and drag other icons to make room.
Two options on the running session card are worth knowing:
Midnight Oil starts when you log in. To stop that, turn off Launch at login in Settings › General.
Midnight Oil asks for nothing up front. macOS asks for each permission only the first time you use the feature that needs it:
| Feature | What macOS asks | Where to change it later |
|---|---|---|
| Closed-lid mode | Approve the Midnight Oil helper | System Settings › General › Login Items (& Extensions) |
| Wi-Fi network triggers | Location access, because macOS treats the network name as location data | System Settings › Privacy & Security › Location Services |
| Bluetooth device triggers | Bluetooth access | System Settings › Privacy & Security › Bluetooth |
| Notifications | Permission to show notifications | System Settings › Notifications |
Setting up closed-lid mode: open Settings › Closed Lid and click Install…, and macOS opens Login Items. Switch on Midnight Oil under Allow in the Background. That's the only time you'll need an admin password. You can remove the helper from the same settings pane.
midnightoil run -- <command> keeps the Mac awake until the command finishes, closed lid included. Built for AI agents (details).Every setting has an ⓘ: hover for a hint, click for the full explanation.
The midnightoil command starts and stops sessions from Terminal, so you, a script, or an AI agent can keep the Mac awake for exactly as long as a job runs. Unlike caffeinate, it can keep a MacBook running with the lid closed, and your battery settings still apply.
midnightoil run -- claude -p "fix the failing tests" # awake until the command finishes
midnightoil run --lid-closed -- npm run build # ...even with the lid shut
midnightoil start --for 2h # or --until 6am
midnightoil status
midnightoil stop
run starts the command, keeps the Mac awake while it runs, and exits with the command's exit status. Its own messages go to stderr, so you can still pipe the command's output. Runs started in parallel share one session, which lasts until the last one finishes.start keeps the Mac awake until you stop it, or for a while with --for 90m or --until 6:30pm. --while-pid 4242 follows a process that's already running.--lid-closed (needs the one-time closed-lid setup), --allow-display-sleep, and --json for scripts. Leave them out and your defaults from Settings apply.start and run open it in the background. Sessions show up in the menu bar like any other, and you can end them there.Installing the command: Homebrew links it for you. If you installed from the DMG, link it once:
sudo mkdir -p /usr/local/bin
sudo ln -sf "/Applications/Midnight Oil.app/Contents/MacOS/midnightoil" /usr/local/bin/midnightoil
For AI agents: add a line like this to your CLAUDE.md or AGENTS.md so long jobs don't stall when the Mac sleeps:
For commands that take more than a few minutes, run them through `midnightoil run -- <command>` so the Mac stays awake until they finish.
My Mac still went to sleep.
pmset -g assertions in Terminal while a session is running. You should see Midnight Oil listed as preventing sleep.A Wi-Fi trigger never starts. macOS only reveals the network name to apps with Location access. If you declined the prompt, the Wi-Fi condition shows a notice with a Turn On… button, or go to System Settings › Privacy & Security › Location Services.
The external drive still sleeps. Add it in Settings › Drive Alive, or turn off Put hard disks to sleep when possible in System Settings › Battery › Options (or Energy on a desktop Mac).
Something else. Open an issue with your macOS version, your Mac model, and what you expected to happen. The guides cover macOS sleep settings, clamshell mode, and running AI agents overnight.
Updating: Midnight Oil checks for updates on its own, and you can check any time from the menu with Check for Updates…. With Homebrew, brew upgrade --cask midnightoil works too.
Uninstalling:
brew uninstall --cask midnightoil. If you linked the command yourself, also run sudo rm /usr/local/bin/midnightoil.To remove its settings and session history as well, delete ~/Library/Application Support/Midnight Oil and ~/Library/Preferences/app.midnightoil.MidnightOil.plist, or run brew uninstall --zap --cask midnightoil.
Midnight Oil has no account and no analytics. Its only network request is the update check to GitHub, which you can turn off with Check for updates automatically in Settings › General. Session history stays on your Mac.
brew install xcodegen swiftlint
The Xcode project is generated from project.yml, so it isn't checked in. Generate it first:
xcodegen generate
Run the tests and the linter the same way CI does. This needs no signing certificate:
xcodebuild -project MidnightOil.xcodeproj -scheme MidnightOil CODE_SIGNING_ALLOWED=NO test
swiftlint --strict
To run the app, open MidnightOil.xcodeproj in Xcode, choose your own team under Signing & Capabilities for the MidnightOil and MidnightOilHelper targets, and press Run.
Closed-lid mode in your own build: the helper only accepts connections from an app signed by the official team, so closed-lid mode won't work in a build signed by anyone else. To try it, replace the team ID KPQU8X839X with yours in Shared/HelperProtocol.swift and project.yml. Don't commit that change. Everything else works without it.
| Path | What's in it |
|---|---|
MidnightOil/ | The menu bar app (SwiftUI and AppKit) |
Packages/MidnightOilCore/ | Session timing, trigger rules, schedules, download detection, and statistics, with unit tests; no app needed to test them |
MidnightOilHelper/ | The privileged helper for closed-lid mode |
Shared/ | The protocol between the app and the helper |
ee/ | Midnight Oil for Teams, under a separate commercial license |
site/ | The website, generated by site/_build/render.py |
Scripts/release.sh | Builds, notarizes, and publishes a release |
Contributions are welcome. See CONTRIBUTING.md.
macOS sleeps a laptop when the lid closes, whatever apps ask for. Midnight Oil ships a small helper, registered with SMAppService, that runs pmset disablesleep 1 as root while a closed-lid session runs and pmset disablesleep 0 the moment it ends. If the app quits or crashes, the helper notices the dropped connection and restores sleep. If the helper itself stops, launchd restarts it and it restores sleep on launch. Nothing is left disabled behind your back.
Maintainers release from main with Scripts/release.sh 1.2.3. It builds, signs with a cloud-managed Developer ID, notarizes the app and the DMG, signs the Sparkle update, publishes the GitHub release, and updates the Homebrew cask. The script's header lists the one-time credentials it needs.
Organizations that manage Macs can deploy Midnight Oil with their MDM, lock policies, get session webhooks, and see their fleet on a dashboard. That code lives in ee/ under its own commercial license. None of it changes how the app behaves, or contacts any server, unless an organization's license and configuration profile turn it on. Details at midnightoil.app/teams.
FSL-1.1-MIT © Corey Haines. Free to use and modify, including at work. You can't resell it or build a competing product from it. Each release becomes MIT two years after it ships, and versions 1.0.0 through 1.3.0 are MIT already.
The Midnight Oil name and icon are covered by the trademark policy. Contributions are welcome under the contributor terms.