Skip to content

currylaksa/ramusagebar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

RAMBar 🧠

A tiny RAM gauge for your macOS menu bar. One Swift file, zero dependencies, basically zero footprint.

┌──────────────────────────────┐
│  … 🔋 📶  ▐▓▓░▌ 46%  Wed 21:24 │   ← that's RAMBar
└──────────────────────────────┘

Why?

Activity Monitor is a whole app. iStat Menus is $12. htop needs a terminal. Sometimes you just want to glance at the top of your screen and know if Chrome has eaten your machine yet.

RAMBar is ~150 lines of Swift that does exactly one thing: shows how much memory is in use, and turns angry colors when things get spicy.

What you get

  • A tiny fill gauge + percentage in the menu bar — adapts to light/dark mode
  • Color thresholds — calm by default, 🟠 orange at ≥70%, 🔴 red at ≥85%
  • Click for the breakdown — App Memory, Wired, Compressed, and Swap, fetched fresh the moment you open the menu
  • The same math as Activity Monitor — "Memory Used" = app + wired + compressed, read straight from the Mach kernel (host_statistics64), not parsed from some CLI output

What it costs your machine

Almost nothing, on purpose:

  • Wakes up every 30 seconds with a 10s tolerance, so macOS batches it with other timers (better battery)
  • Skips redrawing entirely when the percentage hasn't changed — most ticks are a single syscall and a nap
  • No Dock icon, no windows, no network, no config files, no framework beyond AppKit
  • Compiles to a single small binary

Install

git clone https://github.com/currylaksa/ramusagebar.git
cd ramusagebar
bash install.sh

That's it. The script compiles RAMBar.swift, wraps it in a proper .app bundle at ~/Applications/RAMBar.app, and registers a LaunchAgent so it starts automatically at every login.

Requires macOS 12+ and Xcode Command Line Tools (xcode-select --install if swiftc isn't found).

Uninstall

launchctl unload ~/Library/LaunchAgents/com.wilderfarer.rambar.plist
rm -rf ~/Applications/RAMBar.app ~/Library/LaunchAgents/com.wilderfarer.rambar.plist

Gone without a trace.

How it works

The entire app is RAMBar.swift:

  1. host_statistics64 asks the Mach kernel for VM stats
  2. Used memory = (internal − purgeable) + wired + compressor pages — the same formula Activity Monitor uses for "Memory Used"
  3. Swap comes from sysctl vm.swapusage
  4. An NSStatusItem draws a little rounded-rect gauge and the percentage
  5. A 30-second Timer repeats forever; the dropdown numbers are only computed when you actually open the menu

No Electron. No menu bar app framework. No 200MB of node_modules to display one number.

License

MIT — do whatever you want with it.

About

Tiny macOS menu bar RAM gauge — one Swift file, zero dependencies

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages