Working with Multiple Versions of Xcode

Geoff Hackworth
7 min readJun 3, 2017

--

Note: This article was originally written in June 2017. It was updated in June 2019 to include screenshots and examples from newer versions of Xcode.

Using the Mac App Store version of Xcode is the simplest way to keep up to date. Depending on your Preferences in the App Store app, apps will update automatically or you will be prompted when updates are available.

App Store Preferences

If using the latest version of Xcode was always the best thing to do, life would be simple.

Life is Not That Simple!

The version of Xcode you use to build your app has a number of important consequences.

  • It sets the base SDK version that you are building against. This can implicitly opt you in to certain OS features or device support. For example, building against the iOS 12 SDK in Xcode 10.x opts your app in to support the iPhone XS Max and iPhone XR screen sizes. Build with Xcode 9.x (against the iOS 11 SDK) and even when opened on an iPhone XS Max running iOS 12, your app will use the iPhone X resolution and be scaled to fill the larger screen. See How iOS Apps Adapt to the iPhone XS Max and iPhone XR Screen Sizes for more information.
  • For Swift code, the version of the language itself can change. This was particularly important during the Swift 2.x to 3.0 timeframe when the language underwent many significant, and incompatible, changes. Still using Swift 3? You can’t use Xcode 10.2 or higher. Upgraded your code to Swift 5? You can’t use Xcode 10.1 or lower.
  • Support for older OS versions. Xcode is quite aggressive at dropping simulator support for older iOS versions. If you want simulator support for more than the current and previous two or three major iOS versions, you often can’t use the latest Xcode release.
  • Xcode betas. At the time of writing, WWDC 2019 is about to start. If you want to start testing against beta OS versions or take advantage of new APIs, you’re going to need to use a beta version of Xcode. You can’t release app updates built with a beta version of Xcode.

Having multiple versions of Xcode available provides more flexibility. It’s good practice to try and stay up-to-date, but sometimes you need the ability to release an app built with an older version. This is especially important just after the public release of a major iOS version in September. If your app isn’t quite ready to opt in to all the new features but you need to release an update, you will need to build with an older version of Xcode.

Installing Multiple Versions of Xcode

For the most flexibility, the best approach is to download specific versions of Xcode manually rather than using the Mac App Store version. Apple provides download links for released versions of Xcode on its website at https://developer.apple.com/download/all. Between WWDC and public release, the latest beta version of Xcode can be downloaded from https://developer.apple.com/download/. The link on that page for the currently released version just directs you to the Mac App store. It’s best to use the manual download. Sometimes it takes a little while for the most recent public release to become available for manual download.

Apple is sometimes slow to update their downloads page with new versions of Xcode. A great resource with direct download links is xcodereleases.com. The site also includes release dates, release notes and SDK versions.

Installing a specific version is easy.

Xcode 8 and later (.xip):

  • Download. Download the .xip file.
  • Unarchive. Double click the .xip file in your Downloads folder to unarchive it.

Xcode 7 and earlier (.dmg):

  • Download. Download the .dmg file.
  • Install. Double click on the .dmg file. The installer suggests dragging Xcode.app to the Applications folder. If you already have an Xcode.app in /Applications (perhaps the Mac App Store version), don’t do that. Instead, drag it to your desktop.

Once you have an Xcode.app file:

  • Rename. Rename the Xcode.app file to include the version number (e.g. “Xcode10.2.1.app”) to identify the version and to set a unique filename. Downloads of beta versions of Xcode already have a unique name and this step is not required (unless you prefer to use an alternate name).
  • Move to /Applications. Drag the file to your Applications folder.

Only after the Xcode version has been renamed and moved to /Applications is it safe to launch it. Moving its location afterwards can cause problems. On first launch, Xcode sometimes prompts to install command line tools. It’s easiest to just let Xcode do that.

Repeat this process for each version of Xcode you want to install. Over time, you’ll build up a few versions and can remove those you no longer need. Xcode is a big app and uses a lot of disk space.

How far back you need to maintain Xcode versions depends on your apps and how proactive you are at keeping them up-to-date and building with the latest Xcode and iOS versions.

Apple requires app updates to be built with some minimum Xcode version and in the past have supported old versions for quite a long time:

  • Since March 2019 all iOS apps submitted to the App Store need to be built with at least Xcode 10.1 (against the iOS 12.1 SDK) in order to support the iPhone XS Max and 3rd generation 12.9" iPad.
  • From April 2020, all new apps and app updates for iPad will need to be built with Xcode 11 (against the iOS 13 SDK) in order to support the all-screen design of the 3rd generation 12.9" iPad Pro.

Command Line Tools

Developers with more complex build processes prefer to build from the command line. In more recent versions of Xcode, choosing which version of the command line tools to use can be done from the Locations tab in Xcode’s Preferences window:

Xcode Preferences

Alternatively, the version can be configured from the command line:

$ sudo xcode-select -s /Applications/Xcode10.app/Contents/Developer$ xcode-select -p
/Applications/Xcode10.app/Contents/Developer

Launching different Xcode Versions

Older versions of Xcode don’t like being run multiple times but this has improved since Xcode 9. I still recommend only running one version of Xcode and its simulators at once. This reduces the risk of problems and, more importantly, it ensures you don’t accidentally build (or release!) your code with an older/newer version than you intended.

To check which version of Xcode you are currently running, open Xcode’s About menu:

About Xcode

Alternatively, if you are using uniquely versioned Xcode.app names as I recommended earlier, use ⌘-Tab to show the App Switcher and tab round to highlight Xcode to reveal its versioned name:

⌘-Tab App Switcher

Use Finder to double click on a specific Xcode version in the Applications folder or choose the correct version from a Spotlight search. Be careful: Spotlight sometimes adjusts the order it presents the different versions to you!

Spotlight Search for “xcode”

XcLauncher

Alternatively, one of the features of my XcLauncher menu bar app is to launch a specific version of Xcode:

XcLauncher’s Open Xcode menu

XcLauncher’s main feature is to provide bookmarks for your favorite Xcode projects, workspaces and playgrounds right from the system menu bar. For more information take a look at my web site or view it in the Mac App Store.

Other Articles That You Might Like

If you’re an iOS developer you might be interested in my long-running series of articles that show how apps adapt to newer device sizes depending on which Xcode version they are built with:

The screenshots in those articles were taken from the iOS simulator running my Adaptivity iOS app. There is an iPhone-only version of the app to show How iPhone-only Apps Appear on iPad (it changed in iOS 12).

You may not have realised that there were iPad Navigation Bar and Toolbar Height Changes in iOS 12. You must certainly have noticed the View Controller Presentation Changes in iOS 13.

I have also written about External Display Support on iOS and how to Hide Sensitive Information in the iOS App Switcher Snapshot Image.

If you found any of these articles helpful then please take a look at my apps in the iOS App Store to see if there’s anything that you’d like to download (especially the paid ones 😀).

--

--

Geoff Hackworth
Geoff Hackworth

Written by Geoff Hackworth

Independent and freelance software developer for iPhone, iPad and Mac