Skip to content
rootintPublic

About

For those are annoyed by htop on Apple Silicon

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rtop

A tiny htop-style system monitor for Apple Silicon Macs. One C file, zero dependencies, built for living permanently in a small terminal window - at about half the CPU cost of htop, but is also less powerful than htop is.

rtop showing per-core CPU bars, GPU, temperature, power, memory pressure, swap and the process table

Features

  • Per-core CPU bars with E-cores and P-cores told apart by label color (blue = efficiency, yellow = performance)
  • Memory bar colored by real memory pressure - the fill and the used number follow the kernel's pressure level (green/yellow/red)
  • Swap bar
  • GPU utilization bar
  • Die temperature (yellow above 50°C, red above 80°C), AC/battery indicator, and package power with CPU/GPU split
  • Process table sorted by CPU, memory or kind, with real PIDs, full command-line arguments, RES color-coded by size, and a Kind column (A = Apple silicon native, I = Intel under Rosetta 2, highlighted in yellow)
  • Single ~4KB frame written per refresh - no ncurses, no flicker, and the terminal emulator gets to idle between ticks

Requirements

  • Apple Silicon Mac (tested on an M4 Pro, macOS 15)
  • Xcode Command Line Tools (xcode-select --install) for clang

Install

git clone https://github.com/rootint/rtop.git
cd rtop
make
sudo make install     # puts rtop in /usr/local/bin

Then run it:

sudo rtop

sudo is only needed to read other users' processes (their CPU times are EPERM-protected on macOS, same reason people run sudo htop). Without it everything still works, but system processes show 0.0% CPU.

Usage

sudo rtop [-d seconds] [-o]
Flag Meaning
-d <seconds> refresh interval (default 1.25, min 0.5)
-o print one frame and exit (debugging; COLUMNS/LINES set the size)
Key Action
c sort by CPU
m sort by memory
k sort by kind (Intel processes first)
p toggle basename (default) / full executable path
q quit

The layout adapts to the window; it is designed to be comfortable at 56×20.

How it works

Data Source API status
Per-core CPU host_processor_info public
Memory / swap / uptime host_statistics64, sysctl public
Memory pressure kern.memorystatus_vm_pressure_level public
Process list libproc (proc_pidinfo, proc_pidpath) public
Command lines sysctl KERN_PROCARGS2 public
Process kind (Rosetta) sysctl KERN_PROC_PID → P_TRANSLATED public
GPU utilization IOKit IOAccelerator PerformanceStatistics semi-public
Die temperature IOHIDEventSystemClient PMU sensors private
Package power libIOReport "Energy Model" counters private
Battery / AC IOKit AppleSmartBattery semi-public

The private APIs are resolved at runtime (dlopen/dlsym); if an macOS update breaks them, the temperature and wattage fields go blank and everything else keeps working. This is the same mechanism used by powermetrics, macmon, and most Mac monitoring tools.

Why

Got annoyed by yet another rendering issue of htop and decided to quickly code myself a new htop-like program, tinkered to my needs (mactop and gotop don't look good in a 55x20 window). Basically, it's an htop, but with a bit less features than I didn't need, GPU and temperature data and some additional color coding. Was written by Fable 5.

License

MIT

About

For those are annoyed by htop on Apple Silicon

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages