Top Alternatives to macOS ‘top’ Command: CLI Process Monitoring Tools for Developers


2 views

While macOS's built-in top command provides basic process monitoring, it lacks many advanced features Linux users expect:

# Basic macOS top output (truncated)
Processes: 423 total, 4 running, 419 sleeping, 1484 threads
CPU usage: 12.3% user, 6.7% sys, 80.9% idle
PID    COMMAND      %CPU TIME     #TH   #WQ  #PORT MEM    PURG
1234   WindowServer 45.2 03:45:12 18    5    569   357M   0B
5678   Google Chrome 22.1 01:23:45 32    2    890   1.2G   0B

1. Gotop (Go-based)

Install via Homebrew:

brew install gotop

Features include:

  • Color-coded CPU/memory/network stats
  • Interactive process management (kill, renice)
  • Customizable UI via config file

2. Glances (Python-based)

Installation:

pip install glances

Example usage with web server mode:

glances -w --port 61208
# Access via http://localhost:61208

3. vtop (Node.js-based)

Installation:

npm install -g vtop

Key advantages:

  • Beautiful ASCII art graphs
  • Mouse support for process selection
  • Theme customization

For Xcode users, the Instruments CLI provides detailed metrics:

xctrace list devices
xctrace record --template 'Time Profiler' --output MyAppProfile.trace

For quick custom monitoring:

ps -eo pid,user,pcpu,pmem,command \
  | awk 'NR==1 || $3>10.0 || $4>5.0' \
  | sort -k3 -r

This shows processes using >10% CPU or >5% memory.

When choosing an alternative, consider:

  • Go/Node.js tools may have higher baseline CPU usage
  • Python tools might show latency with many processes
  • Native solutions (like Instruments) provide lowest overhead

As a long-time macOS user and developer, I've always found the built-in top command frustratingly limited compared to its Linux counterparts. The Linux version offers:

  • Interactive column sorting with < and > keys
  • Color-coded display (activated with z)
  • Better process tree visualization
  • More configurable display options

1. Glances - Cross-Platform System Monitor

Install via pip:

pip install glances
glances

Key features:

  • Web interface option (glances -w)
  • Process sorting by CPU/MEM
  • Disk I/O monitoring
  • Network traffic visualization

2. nmon - Nigel's Performance Monitor

Brew installation:

brew install nmon
nmon

Try these interactive commands in nmon:

c - CPU view
m - Memory view
d - Disk view
n - Network view

3. btop++ - The Htop Alternative That Works

Installation:

brew install btop
btop

Configuration file location:
~/.config/btop/btop.conf

For those who prefer sticking with top, here's a useful alias for your .zshrc:

alias mytop="top -o cpu -stats pid,command,cpu,mem,time,state -s 5"

For deep process inspection:

sudo dtrace -n 'syscall:::entry { @[execname] = count(); }'

This gives you real-time system call statistics per process.

For developers wanting an all-in-one monitoring solution:

brew install gotop
gotop -l brew

Or try gtop (Node.js based):

npm install -g gtop
gtop