Glances on macOS Monterey without compiling Rust and LLVM
Glances is a nice top replacement. On an
Intel Mac running macOS Monterey it came from Homebrew, and keeping it up to
date had become absurdly expensive. This is why, and how I moved it to a plain Python
venv installed from prebuilt wheels.
Why: Homebrew on an unsupported macOS
Homebrew only builds bottles (prebuilt binaries) for the last few macOS releases. Monterey dropped off that list a while ago, so on this machine every install and every upgrade compiles from source.
For Glances that is worse than it sounds. Following the dependencies of what was installed:
glancesdepends onpydanticandcryptography, andmaturinwas there too.- All three have Rust inside (
pydantic-coreis Rust,cryptographyhas a Rust core,maturinbuilds Rust extensions), so building them needsrust. - The Homebrew
rustformula links against Homebrew’sllvm. llvmhas no bottle either, so it builds from source too: hours of compiling and about 1.6GB on disk.
Asking which installed formulas actually need these two shows how little they were doing:
brew uses --installed llvm # rust
brew uses --installed rust # (nothing at runtime)
brew uses --installed --include-build rust # cryptography glances maturin pydantic
rust was needed only to build those Python packages, and llvm only for rust.
A monitoring tool was dragging a full compiler toolchain along.
The wheels already exist
PyPI is a lot friendlier than Homebrew to old Intel Macs. Checking the latest releases for macOS x86_64 wheels:
| Package | macOS x86_64 wheel |
|---|---|
glances |
pure Python (py3-none-any) |
psutil |
yes, abi3, macOS 10.9+ |
pydantic-core |
yes, macOS 10.12+, up to CPython 3.15 |
maturin |
yes, macOS 10.12+ |
cryptography |
no: latest ships arm64 only; 48.0.1 is the last with a universal2 wheel |
The good news: Glances itself doesn’t need cryptography or pydantic at all. Its
install pulls in just psutil, defusedxml, packaging, jinja2, MarkupSafe and
shtab, and all of them have wheels.
How: a venv, wheels only
Put each small tool in its own folder, here ~/tools/glances:
mkdir -p ~/tools/glances
cd ~/tools/glances
python3 -m venv .venv
.venv/bin/pip install --upgrade pip
.venv/bin/pip install --only-binary=:all: glances
--only-binary=:all: is the important bit. Without it, pip silently falls back to
building from source whenever a wheel is missing, and you’re back to needing a
compiler. With it, pip fails loudly instead, which is what you want on a machine where
“build from source” means Rust.
Run it with:
~/tools/glances/.venv/bin/glances
or add an alias so it wins over any leftover Homebrew one:
alias glances=~/tools/glances/.venv/bin/glances
Two surprises
A root-owned log file. The first run died with:
PermissionError: [Errno 13] Permission denied: '~/.local/share/glances/glances.log'
An earlier sudo glances had created ~/.local/share/glances owned by root. Giving it
back fixes it:
sudo chown -R "$(id -un)":staff ~/.local/share/glances
Glances also honours XDG_CACHE_HOME if you’d rather put the log somewhere else.
Git doesn’t see the folder. If ~/tools is a git repo, git status shows
nothing new. Since Python 3.13, python -m venv drops a .gitignore containing just
* inside the venv. That ignores everything in .venv, and git doesn’t show
directories without trackable files, so glances/ simply vanished. No need to add
.venv/ to the repo’s .gitignore anymore.
To keep the setup itself in git, track a requirements file next to the venv:
.venv/bin/pip freeze > requirements.txt
git add requirements.txt
and rebuilding it anywhere is one line:
python3 -m venv .venv && .venv/bin/pip install --only-binary=:all: -r requirements.txt
Cleaning up Homebrew
With Glances out of Homebrew, nothing installed needs the toolchain any more:
brew uninstall glances maturin pydantic cryptography rust llvm
If you still want cryptography for other Python work on an Intel Mac, install it in a
venv with 'cryptography<=48.0.1' and --only-binary=:all:. The catch is that it stays
on that version and misses later security fixes, so weigh that before relying on it.