Homebrew makes it really simple, I mostly use this for installing multiple versions of Python without the added complication of using Docker.
Just install the version of the program/utility/tool you need by specifying it with an @
.
brew install python@<version-number>
# For example:
brew install python@3.9
brew install python@3.11
You can then use each version like this:
/opt/homebrew/bin/python3.9
/opt/homebrew/bin/python3.11