Home/Guides/How to install multiple Xcode versions on one Mac and switch between them

How to install multiple Xcode versions on one Mac and switch between them

Updated · airankrush

What this guide covers

When you finish, you can say exactly which Xcode each build command uses, and switching will not affect other jobs on the machine. You need: at least one Xcode already installed, an Apple Account, and enough disk space.

Steps

  1. Install the second version from the developer site download

    The App Store keeps only one Xcode, so to run versions side by side, download the specific version from the Apple Developer site. After expanding it, rename it before dragging it into Applications. For example, name a beta Xcode-beta.app (the same example the xcode-select manual uses) so it does not overwrite the one you already have.

    Before installing, check the table on the Xcode support page to confirm the older version still supports the macOS currently on this machine.

  2. See which one is currently active

    Command-line tools (xcodebuild, xcrun and so on) use the Xcode that the "active developer directory" points to. It has nothing to do with which icon you click in the Dock. To check:

    xcode-select --print-path
    xcodebuild -version
  3. Global switch: choose it in Xcode settings

    Following Apple's command-line tools settings documentation, open Xcode > Settings, click Locations, pick the version you want from the Command Line Tools pop-up menu, and enter the admin password when prompted.

    The same document also gives a Terminal command for switching. It requires superuser privileges, so we do not reproduce it here; refer to the original document if you need it. Note what the manual says: a global switch applies to every user on the machine.

  4. Switch for a single command: DEVELOPER_DIR

    If you do not want to touch the global setting, set an environment variable for the moment. Apple's documentation says it overrides the active developer directory and does not require superuser privileges:

    env DEVELOPER_DIR="/Applications/Xcode-beta.app" xcodebuild -version

    The variable affects only that one command (or the terminal session where you exported it). Other terminals and jobs are unaffected.

  5. On build machines, prefer DEVELOPER_DIR

    In CI jobs, putting DEVELOPER_DIR in each job's own environment variables is more reliable than a global switch. Two projects queued at the same time cannot change each other's environment, and the log shows directly which Xcode a run used.

    A global switch suits the case where the machine works on essentially one project.

  6. Run first-launch setup for the version you just switched to

    Before using an Xcode for the first time, open its graphical interface to complete the license and component installation, or run xcodebuild -runFirstLaunch. Simulator runtimes are matched to the Xcode version, so an older version may need its own runtime downloaded separately.

  7. Trade-offs on a rented machine: disk and reclamation

    Every extra Xcode and its runtimes takes a large chunk of disk. Keep only the versions your projects really need; move unused ones to the Trash entirely and remove their simulator runtimes.

    Write down in the repository which project depends on which Xcode (for example in the CI configuration). The machine is reclaimed when the rental ends, so this information should not live only in this machine's settings. See the plans page for disk configurations.

FAQ

Do I need to restart the Mac after switching versions?

No. After a global switch or setting DEVELOPER_DIR, newly started commands use the new developer directory straight away. Do not shut the machine down yourself during the rental either; when a restart is really needed, use the restart option in the customer console.

Does a global switch affect the platform's management components?

The manual says a global switch applies to all users, but it only decides which Xcode the developer tools are taken from. It has nothing to do with the remote-access and management components. Do not change the network configuration or remove system entries you do not recognize while you are at it.

Can I open two versions of Xcode at the same time?

Both apps can run, but memory and disk use add up, and opening the same project in two versions at once is not recommended. Over a remote session, how smooth the picture is already depends on your local network connection, so try to keep only one open.

What if an old Xcode will not open on a newer macOS?

Check the table on Apple's support page to see whether that version supports the current macOS. If it does not, there is no official way to force it to run. Downgrading the system is a platform-side operation; contact Contact support to ask whether it is possible.

Pricing and availability: see the plans page · Help center (中文) · Refund policy (中文) · Telegram Contact support

Back to home · All guides