Skip to content

About

A small, htop-style macOS monitor for CPU and resident memory used by each Ghostty terminal tab.

Resources

Contributing

Security policy

Stars

12 stars

Watchers

0 watching

Forks

Latest commit

 

History

81 Commits

Folders and files

Repository files navigation

ghostty-top

Shows how much CPU and memory each Ghostty tab is using, and how much time you spend in each one.

image

Install

bun install -g ghostty-top

Or npm install -g ghostty-top. Or build it yourself with cargo install --path ..

Nothing else to install and nothing to configure. Building from source needs Rust 1.89 or newer.

Linux: build from source with cargo install --path .. The monitor works the same, but the usage calendar doesn't: Ghostty only reports which tab you're looking at on macOS, so there's no way to measure per-tab time elsewhere. Rows are named by folder instead of tab name for the same reason. The npm package ships a Mac binary only.

Run it

ghostty-top          # the live monitor
ghostty-top --once   # print once and exit

Each row is one Ghostty tab. Ghostty draws all tabs in a single process, so the memory that process uses is shown on its own line at the top.

If you use herdr, its panes run under a background server rather than under Ghostty. Each local herdr server gets a herdr server row, with its tabs branched underneath as ├─ workspace › tab. Sessions on other machines are left out, since they use none of this Mac's memory.

You can use the mouse for everything. Click a column title to sort by it, click it again to flip the order, click a row to select it, and click it once more to see the processes inside. The controls at the bottom are buttons too.

Keys, if you prefer them:

Key What it does
↑ ↓ Move between tabs
enter Show the processes in a tab
c m g p a n t Sort by CPU, memory, trend, processes, age, activity, tab
u Open the usage calendar
q Quit

Usage calendar

Press u. There are three ways to look at it, with d, w, and c:

  • daily – one square per day. Brighter means more time.
  • weekly – one bar per week.
  • cumulative – the total adding up over time.

Point at any square or bar to see its total. Click it to see which tabs the time went to.

Time in a local herdr session goes to the herdr tab you're on, shown as herdr › workspace › tab. That relies on herdr's default window title ({hostname}: {workspace}); with a custom title, or a remote session, the time goes to the Ghostty tab instead.

This part is macOS only. Time only counts when Ghostty is the app you're using and you're actually at your Mac. Nothing is counted when the lid is closed, when the screen has been idle, or while the Mac is asleep.

To keep counting when the monitor isn't open:

ghostty-top --track           # in this window
ghostty-top --install-tracker # in the background, starting at login

Run --install-tracker again after updating ghostty-top, so the background copy is updated too. --uninstall-tracker stops it and keeps your history.

What gets saved

Everything is saved in ~/Library/Application Support/ghostty-top/ and stays on your Mac. It saves tab names, folder paths, program names, and CPU and memory readings. It does not save anything you type or anything printed in your terminal, and it never saves command arguments or environment variables, because those can contain passwords and keys.

Detailed telemetry rotates when a file reaches 10 MiB, keeping three backups per file. The oldest backup is deleted on the next rotation. Superseded resource and process schemas are removed when the current schema first opens. Daily totals in usage.tsv are kept; uninstalling the tracker preserves them.

The first time it reads tab names, macOS asks you to allow it to control Ghostty. That permission is only needed once.

Good to know

  • CPU adds up every process in a tab, so it can go over 100% on a Mac with several cores.
  • RAM uses physical footprint, the metric Activity Monitor shows, including compressed and swapped memory. When macOS denies a reading (often for root-owned login or sudo processes), it falls back to resident size and marks the process and tab with ~. That total may understate memory use. Press enter to compare RAM and RESIDENT.
  • Memory adds up each process, and programs often share memory, so treat the number as a rough guide.
  • A leak warning points at one process whose memory has been climbing steadily for a few minutes. Growth compares averaged edges of a rolling window of up to 15 minutes; the warning shows its actual span. It's worth a look, but it isn't proof of a problem.

Run ghostty-top --help to see every option.

Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md for how to get set up and what to check before opening one.

License

MIT

About

A small, htop-style macOS monitor for CPU and resident memory used by each Ghostty terminal tab.

Resources

Contributing

Security policy

Stars

12 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages