Install and switch between Xcode versions
Keep several Xcode versions side by side with xcodes, and pick one per shell or build.
CI and older projects often need a specific Xcode. The open-source xcodes tool installs any version from the command line:
brew install xcodesorg/made/xcodes
xcodes list # versions you can install
xcodes install 16.0 # use the version you need
xcodes select 16.0 # make it the default
It asks for your Apple Account to download from Apple (or set XCODES_USERNAME and XCODES_PASSWORD).
Pick a version without changing the default
sudo xcode-select -s /Applications/Xcode-16.0.app # system-wide
export DEVELOPER_DIR=/Applications/Xcode-16.0.app # this shell only
Each Xcode takes a lot of disk space, so remove the versions you no longer use.