DEV Community

10x learner
10x learner

Posted on • Originally published at 10xlearner.com on

10 3

How to switch between 2 versions of Xcode installed on your computer

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>
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Thank you all for reading this article, And until my next article, have a splendid day 😉

Interesting links

Jetbrains image

Is Your CI/CD Server a Prime Target for Attack?

57% of organizations have suffered from a security incident related to DevOps toolchain exposures. It makes sense—CI/CD servers have access to source code, a highly valuable asset. Is yours secure? Check out nine practical tips to protect your CI/CD.

Learn more

Top comments (0)

Image of Quadratic

Free AI chart generator

Upload data, describe your vision, and get Python-powered, AI-generated charts instantly.

Try Quadratic free

👋 Kindness is contagious

Dive into this thoughtful article, cherished within the supportive DEV Community. Coders of every background are encouraged to share and grow our collective expertise.

A genuine "thank you" can brighten someone’s day—drop your appreciation in the comments below!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found value here? A quick thank you to the author makes a big difference.

Okay