GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - esaruoho/apple-energy: The Activity Monitor Energy tab (and more) from the macOS CLI — energy/power/heat + running Claude Code session enumeration, jump-to-tab, and kill/off. No deps.

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
_apple_energy.py
_apple_energy.py
 
 
apple-energy
apple-energy
 
 

Repository files navigation

apple-energy

The Activity Monitor Energy tab — and more — from the macOS command line.

Activity Monitor's energy data is just a front-end over Apple-shipped tools (powermetrics, top, system_profiler, pmset). apple-energy wraps them into one tool, adds a per-process "what it is" annotator, and can enumerate and jump between your running Claude Code sessions.

No Homebrew, no pip, no dependencies — pure Apple: powermetrics + top + system_profiler + pmset + lsof + python3 stdlib. Two files, one of them a shell script.

$ apple-energy now
┌───────┬───────────────┬────────────────────────────────────────────────┬───────┐
│  PID  │    Process    │                   What it is                   │ Power │
├───────┼───────────────┼────────────────────────────────────────────────┼───────┤
│ 554   │ fileproviderd │ File Provider (iCloud/3rd-party file sync)     │  89.3 │
│ 174   │ WindowServer  │ macOS display compositor (system, can't quit)  │  43.8 │
│ 12231 │ claude        │ 2.1.197 ok · «my-session» · 14m · ~/work · …   │  11.4 │
└───────┴───────────────┴────────────────────────────────────────────────┴───────┘

Install

git clone https://github.com/esaruoho/apple-energy.git
cd apple-energy
ln -s "$PWD/apple-energy" /usr/local/bin/apple-energy   # or add this dir to PATH

apple-energy finds _apple_energy.py next to itself, so keep the two files together. Requires macOS and python3 (the Command Line Tools python is fine).

Commands

Read (telemetry)

Command What it does
apple-energy now [N] Top N processes by energy impact (same metric as Activity Monitor), no sudo. Each row is annotated with what it actually is.
apple-energy watch [mins] [secs] Sample powermetrics over a window and print a ranked per-process energy report — fills the gap that macOS keeps no historical per-app energy store. (sudo)
apple-energy power [N] System CPU / GPU / package watts (mW). (sudo)
apple-energy heat [N] Heat = watts. Package power + thermal pressure + throttle state + fans. On a chip ~100% of drawn power becomes heat, so package watts are the heat-generation rate. (sudo where available)
apple-energy adapter Power adapter wattage + battery state (health, cycles, charge). No sudo. Superset of system_profiler SPPowerDataType | grep Wattage.
apple-energy claude List every running Claude Code session: version, OLD-vs-current flag, readable age, %CPU, terminal (iTerm2/Terminal), TTY, project, and session name.

Act

Command What it does
apple-energy jump <pid|tty|version|project|name> Focus that Claude session's terminal window/tab (iTerm2/Terminal, via each app's own AppleScript verbs).
apple-energy kill <name|pid> SIGTERM a hog now. Refuses critical/system processes.
apple-energy off <name> [--yes] For a launchd-kept hog that respawns after kill: stop it and launchctl disable it so it stays dead. Dry-run by default; --yes executes.
apple-energy install-jump Register the aejump:// URL scheme so claude/now TTYs are Cmd-clickable (iTerm2 only — see below).

Notes

  • Energy Impact is a relative unit (the same one Activity Monitor shows), not watts. power/heat report actual watts.
  • No historical per-app energy store exists on macOS — Activity Monitor's "Avg Energy Impact" is a rolling in-memory window that isn't exposed. So "top apps over the last hour" must be recorded: that's what watch does.
  • Claude Code sessions are identified by mapping each process's start time to its transcript's first-message timestamp; the name is the session's customTitle → summary → first user message. A ~ prefix means the name was inferred (e.g. a resumed session).
  • Clickable TTYs use OSC 8 hyperlinks and work in iTerm2 (after a one-time "allow control" prompt). Terminal.app does not support OSC 8, so use apple-energy jump <name> there.
  • sudo verbs (watch, power, heat) shell out to powermetrics, which requires root. Everything else is unprivileged.

License

MIT © Esa Ruoho

About

The Activity Monitor Energy tab (and more) from the macOS CLI — energy/power/heat + running Claude Code session enumeration, jump-to-tab, and kill/off. No deps.

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.