52

I am facing a problem running older versions of Xcode on newer MacOS versions.
For example, Xcode 13 on MacOS Ventura.

stackich
  • 3,607
  • 3
  • 17
  • 41

5 Answers5

89

The solution is very simple. If you have the older version downloaded in your Applications folder for example, lets say 12.5.1 version, you just need to:

  • Open Terminal
  • Open Applications folder in Finder
  • Drag the Xcode app into Terminal so it gets its path
  • Then add this next to it: /Contents/MacOS/Xcode, so the full command will be something like /Applications/Xcode-12.5.1.app/Contents/MacOS/Xcode
  • Press enter to run the command

Now you should be able to run it. You will note that when you open this version of Xcode, the Terminal will open too, but don't close Terminal because it will close the Xcode too.

Here you can find older Xcode versions.

stackich
  • 3,607
  • 3
  • 17
  • 41
53

Change the paths to OLD/NEW Xcodes and run script. The script will change the build version of the old Xcode to the new one, run it and restore. Script needs to be run once, after that Xcode can be opened via double click

Works on macOS Monterey for Xcode 12.5.1 and Ventura for Xcode 13

#!/bin/sh

set -euo pipefail

# Set the paths to your Old/New Xcodes
OLD_XCODE="/Applications/Xcode_13.4.1.app" # or /Applications/Xcode_12.5.1.app on Monterey
NEW_XCODE="/Applications/Xcode.app" # To get build number

# Get New Xcode build number
OLD_XCODE_BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${OLD_XCODE}/Contents/Info.plist)
NEW_XCODE_BUILD=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" ${NEW_XCODE}/Contents/Info.plist)

echo The Old Xcode build version is $OLD_XCODE_BUILD
echo The New Xcode build version is $NEW_XCODE_BUILD

# Change Old Xcode build version to New Xcode
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${NEW_XCODE_BUILD}" ${OLD_XCODE}/Contents/Info.plist

# Open Old Xcode (system will check build version and cache it)
open $OLD_XCODE || true

# Revert Old's Xcode's build version
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${OLD_XCODE_BUILD}" ${OLD_XCODE}/Contents/Info.plist
Uladzimir
  • 3,067
  • 36
  • 30
  • 5
    I think this answer should be marked as Accepted. Really good approach for "daily" usage. – user2185412 Jan 21 '22 at 10:56
  • as @Mert AYDIN wrote, to find out what is CFBundleVersion of your current Xcode version, use this command to be able to run the accepted answer as your Xcode version might be something else instead of 13.1 `/usr/libexec/PlistBuddy -c "Print CFBundleVersion" /Applications/Xcode_12.4.app/Contents/Info.plist` – ACAkgul Jan 31 '22 at 07:25
  • 4
    Concur, this should be the accepted answer. – Scott Corscadden Feb 05 '22 at 15:28
  • in the first answer by @stakich, I wouldn't open projects. – nyxee Sep 12 '22 at 05:25
  • this solution is not working for **Xcode_10.X** which they say i need to migrate my **Swift 3** projects to **Swift 4**. – nyxee Sep 12 '22 at 05:57
  • 2
    Still working on Ventura if anyone interested – Egor Egorov Oct 24 '22 at 20:27
6

This is how you get your xcode's current build version.

/usr/libexec/PlistBuddy -c "Print CFBundleVersion" /Applications/Xcode_12.4.app/Contents/Info.plist
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 07 '22 at 00:16
  • To find out what is CFBundleVersion of your current Xcode version, use this command to be able to run the accepted answer as your Xcode version might be something else instead of 13.1 @Mert AYDIN thanks, adamsın :) – ACAkgul Jan 31 '22 at 05:40
1

If you are looking for a solution without using terminal every time, here it is:

  1. Follow https://stackoverflow.com/a/69995053/14199447

  2. Create a bash file with this content

    #!/bin/bash
    
    /Applications/Xcode-12.5.1.app/Contents/MacOS/Xcode
    
  3. Open terminal, run chmod 700 YourBashFile.sh

  4. Change the default opening app of YourBashFile to terminal.

  5. Follow step 1 and 2 of this https://apple.stackexchange.com/a/407885 to create an executable application which you can put on your Dock. After this you should be able to use the new app like any other app.

-3
  1. Download and install older Xcode releases from here:

https://xcodereleases.com/

  1. Login will be required with your Apple Developer credentials.

  2. Download and uncompress installer:

e.g. Xcode_13.4.1.xip

  1. from Terminal run:

    open /Applications/Xcode.app/Contents/MacOS/Xcode

  2. Accept agreement and setup any development parameters as needed.

Hugo Barbosa
  • 85
  • 1
  • 4