homebrew
The Missing Package Manager for macOS (or Linux)
One liner install that should work most places:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
There are .pkg releases for MacOS.
About
Homebrew installs packages to their own directory and then symlinks their files into /opt/homebrew (on Apple Silicon).
Homebrew won’t install files outside its prefix and you can place a Homebrew installation wherever you like.