title: How to install and use multiple versions of Xcode command line tools
body: <p>I have a Macbook pro running OS Mojave with Xcode 10.1 and the command line tools are installed at /Application/Xcode.app/Contents/Developer. 
  For a project that I have xcodebuild is invoked from the command line. </p>
  
  <p>I desire to run a static analysis tool against the project (the tool invokes xcodebuild) that doesn't support Xcode 10.1 or the Swift and Clang compiler versions shipped with it.  The tool currently only supports Xcode 9.2.  I downloaded Xcode 9.2, extracted and renamed Xcode.app to Xcode9_2.app and moved it to my Applications folder.</p>
  
  <p>I'm assuming xcodebuild is installed as part of the command line utilities install and that I need to install the command line utilities for Xcode 9.2. However when I try to install them I get a message "Command Line Tools (macOS High Sierra version 10.13) can't be installed on this disk.  The version of macOS is too new."  I also have a concern that the older Xcodebuild could replace the newer one since it is living in /usr/bin.  </p>
  
  <p>The invocation of xcodebuild looks like this: </p>
  
  <pre><code>xcodebuild -workspace ‘MyApp/MyApp.xcworkspace' -scheme ‘MyApp’ -configuration 'Release' -archivePath MyApp.xcarchive archive
  </code></pre>
  
  <p>So my question are:</p>
  
  <p>1) Is xcodebuild part of the command line tools?</p>
  
  <p>2) If it is how do I install various versions of the command line tools?  I'm assuming once they are installed that I can choose with something like:</p>
  
  <p>sudo xcode-select -s /Applications/Xcode9_2.app/Contents/Developer</p>
  
  <p>But again I'm seeing a message preventing installing the Xcode 9.2 command line tools.</p>
  
  <p>I've also seen this other SO <a href="https://stackoverflow.com/questions/38162836/how-do-i-install-xcode-command-line-tools-how-to-install-xcode-9-beta-along-wit">post</a> but I don't think the remove quarantine step is applicable and I don't think it addresses the issue that xcodebuild lives in \usr\bin.  Also I tried renaming Xcode.app that is version 10.1 then renaming Xcode9_2.app to Xcode.app and running in terminal xcode-select --install but it simply says "command line tools are already installed..."</p>