Skip to content
XcodesOrgPublic

About

The best command-line tool to install and switch between multiple versions of Xcode.

Topics

Resources

Contributing

Stars

4.9k stars

Watchers

30 watching

Forks

Repository files navigation

xcodes

The best command-line tool to install and switch between multiple versions of Xcode.

If you're looking for an app version of xcodes, try Xcodes.app.

CI Status

Header Image

🎉 Announcement

Xcodes is now part of the XcodesOrg - read more here

Installation

Homebrew (Preferred)

brew install xcodesorg/made/xcodes

These are Developer ID-signed and notarized release builds and don't require Xcode to already be installed in order to use.

Other methods:

Download a release

Download the latest release from the Releases page. These are Developer ID-signed release builds and don't require Xcode to already be installed in order to use.

Using Mint
mint install XcodesOrg/xcodes
Build from source

Building from source requires a Swift 6.0 or newer toolchain (Xcode 16 or later). The package declares macOS 13 as its minimum macOS deployment target; the selected Xcode version may require a newer macOS version to run. Install and select a full Xcode installation before building, so this is not an option for setting up a computer from scratch. Swift Package Manager downloads dependencies automatically.

git clone https://github.com/XcodesOrg/xcodes
cd xcodes
make install
# Or install into a user-owned directory
make install prefix="$HOME/.local"

The default installation location is /usr/local/bin/xcodes, which must be writable. The Makefile variable is lowercase prefix, not PREFIX; executables are installed into <prefix>/bin. Add that directory to your PATH if needed. You can also override bindir directly.

make builds without installing. Both make and make install produce a universal arm64 and x86_64 executable using release configuration, with Swift optimization disabled (-Onone) as a historical compiler workaround and the build sandbox disabled. Local builds and installation do not invoke the Makefile's Developer ID signing or notarization steps.

Build output path troubleshooting

The Makefile uses SwiftPM to locate the release executable. Run make -s release-bin-path to see the location. For a custom build, override RELEASEBUILDDIR with the absolute path to the executable.

make install prefix="$HOME/.local" \
  RELEASEBUILDDIR="$PWD/.build/out/Products/Release/xcodes"
"$HOME/.local/bin/xcodes" version
"$HOME/.local/bin/xcodes" --help

Run make clean to remove .build, including downloaded dependency checkouts. To remove an installed executable, run make uninstall with the same prefix or bindir used for installation, for example make uninstall prefix="$HOME/.local". Cleaning build artifacts does not uninstall the executable.

While installing, you may get the following output:

swift build
error: terminated(72): xcrun --sdk macosx --find xctest output:

If that occurs, select a full Xcode installation with xcode-select or by choosing a Command Line Tools option in Xcode's Settings > Locations tab. Use swift --version and xcode-select --print-path to check the active toolchain.

Usage

Install Xcode :

Install a specific version of Xcode using a command like one of these:

xcodes install 10.2.1
xcodes install 11 Beta 7
xcodes install 11.2 GM seed
xcodes install 9.0 --path ~/Archive/Xcode_9.xip
xcodes install 27.3 Beta --path ~/Archive/Xcode_27.3_beta.aea
xcodes install --latest-prerelease
xcodes install --latest --directory "/Volumes/Bag Of Holding/"
xcodes install --latest --experimental-unxip

Installing an .aea archive requires macOS with archiveutil extractXcodeAEA. If Xcode Releases has an outdated link, try installing with --data-source apple.

You'll then be prompted to enter your Apple ID username and password. You can also provide these with the XCODES_USERNAME and XCODES_PASSWORD environment variables.

After successfully authenticating, xcodes will save your Apple ID password into the keychain and will remember your Apple ID for future use. If you need to use a different Apple ID than the one that's remembered, set the XCODES_USERNAME environment variable.

xcodes will download and install the version you asked for so that it's ready to use.

(1/6) Downloading Xcode 11.2.0: 100%
(2/6) Unarchiving Xcode (This can take a while)
(3/6) Moving Xcode to /Applications/Xcode-11.2.0.app
(4/6) Moving Xcode archive Xcode-11.2.0.xip to the Trash
(5/6) Checking security assessment and code signing
(6/6) Finishing installation
xcodes requires superuser privileges in order to finish installation.
macOS User Password:

Xcode 11.2.0 has been installed to /Applications/Xcode-11.2.0.app

If you have aria2 installed (it's available in Homebrew, brew install aria2), then xcodes will default to use it for downloads. It uses up to 16 connections to download Xcode 3-5x faster than URLSession.

Xcode will be installed to /Applications by default, but you can provide the path to a different directory with the --directory option or the XCODES_DIRECTORY environment variable. All of the xcodes commands support this option, like select and uninstall, so you can manage Xcode versions that aren't in /Applications. xcodes supports having all of your Xcode versions installed in one directory, wherever that may be.

Architectures

The list and runtimes commands show architecture availability when Apple provides it. Universal downloads are labeled [Universal], Apple Silicon-only downloads are labeled [Apple Silicon], and Intel-only downloads are labeled [Intel].

You can filter either list by architecture or variant with --architecture arm64, --architecture x86_64, --architecture appleSilicon, or --architecture universal. These filters are exact: arm64 and appleSilicon show Apple Silicon-only downloads, x86_64 shows Intel-only downloads, and universal shows downloads that support both architectures. The option can be used multiple times.

xcodes list --architecture arm64
xcodes list --architecture universal
xcodes runtimes --architecture arm64 --architecture universal --include-betas

Install Runtimes :

Run this command line to display the available runtimes

xcodes runtimes --include-betas

Install the wanted Runtime (ex. iOS 17.0-beta1)

xcodes runtimes install "iOS 17.0-beta1"

.xcode-version

We recommend the creation of a .xcode-version file to explicitly declare and store the Xcode version to be used by your CI environment as well as your team.

13.4.1

Read the proposal of .xcode-version.

Commands

  • download <version>: Download a specific version of Xcode
  • install <version>: Download and install a specific version of Xcode
  • installed: List the versions of Xcode that are installed
  • list: List all versions of Xcode that are available to install
  • select: Change the selected Xcode
  • uninstall: Uninstall a specific version of Xcode
  • update: Update the list of available versions of Xcode
  • version: Print the version number of xcodes itself
  • signout: Clears the stored username and password

Experimental Unxip - for faster unxipping

Thanks to the amazing work by saagarjhi - Xcodes now includes the ability to unxip up to 70% faster on some systems.

xcodes install --latest --experimental-unxip

Shell Completion Scripts

xcodes can generate completion scripts which allow you to press the tab key on your keyboard to autocomplete commands and arguments when typing an xcodes command. The steps to install a completion script depend on the shell that you use. More information about installation instructions for different shells and the underlying implementation is available in the swift-argument-parser repo.

Zsh, with oh-my-zsh:

Run the following commands:

mkdir ~/.oh-my-zsh/completions
xcodes --generate-completion-script > ~/.oh-my-zsh/completions/_xcodes

Development

You'll need Swift 6.0 or newer (Xcode 16 or later) to build and run xcodes. See Build from source for installation prerequisites and Makefile troubleshooting. The .swift-version file still contains the historical value 5.3; use the tools version declared in Package.swift as the requirement.

Using Xcode Even though xcodes is a command-line app, all of the normal functionality works in Xcode, like building, running, and running tests. You can even type text into Xcode's console when it prompts you for input like your Apple ID or 2FA code.

When running xcodes from Xcode, if you want to run a particular command or pass some arguments, you can hold the option key to present a sheet with more options. This means you'd use Option + Command + R or hold Option while clicking the Run button. Here you can add, remove, and toggle arguments that will be passed to xcodes when it's launched.

Xcode Edit Scheme Screen

Using Swift command line tools You can also use the Swift command line tools once you have Xcode installed:
  • Build: swift build
  • Run: swift run, or commands like swift run xcodes list
  • Run tests: swift test

There's a Makefile to help build xcodes for distribution. We already do this for you in order to provide Developer ID-signed and notarized release builds via Homebrew (see Installation). The sign, zip, bottle, and notarize targets use a hardcoded maintainer signing identity and require the corresponding certificate and private key. They are not necessary for local development or installation.

Releasing a new version of xcodes

Merge the changes you intend to ship into main in XcodesOrg/xcodes. From this checkout on the maintainer’s Mac, replace VERSION with the exact stable version you want to publish.

./Scripts/release VERSION --dry-run
./Scripts/release VERSION

The dry run shows the GitHub source commit, the notes source, and the Homebrew bottle destination. To customize the notes, edit the Release Drafter draft before running the publish command. The command preserves the draft body and generates GitHub release notes when the draft is missing or empty.

The release command builds and tests in an isolated checkout. It signs and notarizes the universal CLI, publishes the GitHub release and its assets, and updates the Homebrew formula. Success prints the GitHub release URL and Homebrew tap commit. The root AGENTS.md records the commands for future agents.

One-time setup

  • Install and select a full Xcode installation. Install Python 3.9 or newer and the GitHub CLI.
  • Sign in with gh auth login. Use an account with admin push access to CLI main under its current branch protection and push access to main in XcodesOrg/homebrew-made. Set your Git name and email. The command uses your Git signing configuration for commits and annotated release tags.
  • Install the Developer ID Application certificate for team ZU6GR6B2FY and its private key in your Mac’s Keychain. Save your Apple ID notarization credentials in the AC_PASSWORD Keychain profile. Enter the app-specific password when prompted.
xcrun notarytool store-credentials AC_PASSWORD --apple-id YOUR_APPLE_ID --team-id ZU6GR6B2FY

Resuming a release

If the command prints a resume instruction, use the same checkout and version. Prepared artifacts and the release state live under the checkout’s Git directory. Resume reuses verified uploads and completes an outstanding Homebrew update. If main advanced before the tag was pushed, resume builds from current main.

./Scripts/release --resume VERSION

If preparation stops before saving artifacts, resolve the error and rerun the original command. Use the dry run to check GitHub access and the notarization profile, and use security find-identity -v -p codesigning to check the Developer ID identity. If Apple reports a missing or expired agreement, have the Account Holder accept it before retrying. The legacy release.sh command remains available for packaging an already-versioned checkout.

Notable design decisions are recorded in DECISIONS.md. The Apple authentication flow is described in Apple.paw, which will allow you to play with the API endpoints that are involved using the Paw app.

xcode-install and fastlane/spaceship both deserve credit for figuring out the hard parts of what makes this possible.

Maintainers

Matt Kiazyk - Twitter

About

The best command-line tool to install and switch between multiple versions of Xcode.

Topics

Resources

Contributing

Stars

4.9k stars

Watchers

30 watching

Forks

Releases

Used by

Contributors

Languages