xcodes

Install and switch between multiple versions of Xcode easily

brewmacoslinux
Try with needOr install directly
Source

About

Best command-line tool to install and switch between multiple versions of Xcode

Commands

xcodes

Examples

List all available Xcode versions$ xcodes list
Install a specific version of Xcode$ xcodes install 14.2
Switch to an installed Xcode version$ xcodes select 14.2