Is it possible to install and switch between multiple version of Command Line Tools in Mac OS X? I was wondering if it's possible use xcode-select
but the Command Line Tools installer doesn't have an option to choose the installation destination. I tried to create multiple installations by manually renaming Library/Developer/CommandLineTools
and then passing it to xcode-select
. The command succeeds but when I try to access gcc I get:
gcc: error: unable to find Xcode installation from active developer path "/Library/Developer/CommandLineTools_9.0.0", use xcode-select to change
It seems this is possible when installing the whole XCode but I have no need for XCode and prefer not to install it. All I need is the command line tools.
I tried to do the same and after some experiments found the next solution. Yes, it is possible but you need to copy/rename the whole
/Library/Developer
folder. For example:1) first, I just show my macOS version:
2) download and install Command Line Tools for Xcode, e.g. 10b5 version
3) create folders to store different versions of tools:
4) copy the whole Developer folder:
5) then, download and install Command Line Tools for Xcode, e.g. 9.4.1 version
6) copy the whole Developer folder:
7) switch to 9.4.1 version of tools and check the clang version:
8) switch to 10b5 version of tools and check the clang version: