10x learner
Posted on December 8, 2021
Hello ! Iβm Xavier Jouvenot and in this small post, I am going to explain how to switch between 2 versions of Xcode installed on your computer.
Self promotion: You can find other articles on computer science and programming on my website π
Problematic
Recently, I have been working on several projects using different versions of Xcode to be compiled. Since those projects are using CMake to generate the Xcode solution and that I want to compile without leaving the terminal, I had to come up with a solution, and actually, I found out that there is actually a simple and elegant solution to this problem !
Solution
The short answer, for the people who donβt want to read through the entire article (I know you do that ! I do it too π) is using the following command:
sudo xcode-select -s </path/to/your/Xcode.app>
So letβs imagine that, in your Applications
root folder you have 2 applications of Xcode for 2 different versions: Xcode_12.4.app
and Xcode_13.1.app
, then, all you have to do is:
sudo xcode-select -s /Applications/Xcode_12.4.app # Makes Xcode 12.4 you default Xcode
sudo xcode-select -s /Applications/Xcode_13.1.app # Makes Xcode 13.1 you default Xcode
After that, the xcodebuild
you will be using will be the one of the Xcode you selected, and your CMake projects will use this version of Xcode too π
And finally, if you want to know which Xcode you are currently using, all you have to do is to run the following command:
sudo xcode-select -p
Thank you all for reading this article, And until my next article, have a splendid day π
Interesting links
Posted on December 8, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.