KiYugadgeter
KiYugadgeter

Reputation: 4004

How to switch command line tools on MacOS

I installed two commmand line tools on my mac. So I want to switch command line tools. How I can do it?

I tried switch from Xcode preferences > Locations > Command line tools. However, Command line tools beta 1 for Xcode 10 is not appear on this menu.

Xcode 9.4 is installed on my mac.
macOS 10.13.5

Upvotes: 17

Views: 25235

Answers (6)

starterProgrammer
starterProgrammer

Reputation: 286

$ xcode-select -p

/Applications/Xcode.app/Contents/Developer

$ sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer

Password:

$ xcode-select -p

/Applications/Xcode.app/Contents/Developer

$ xcode-select -version

xcode-select version 2339.

$ xcodebuild -version

Xcode 6.4

Build version 6E35b

Upvotes: 1

Michael Tangs
Michael Tangs

Reputation: 189

You can use .bash_profile to add alias to switch 2 versions:

alias Xcode13='sudo xcode-select -s /Applications/Xcode\ 13.app'
alias Xcode14='sudo xcode-select -s /Applications/Xcode.app'

Most important: use source ~/.bash_profile to make the command effective.

Then, input Xcode14 to switch the Xcode version.

Upvotes: 3

Iker Solozabal
Iker Solozabal

Reputation: 1402

For normal versions

Execute on the terminal the following code:

xcode-select --install

For beta versions

Once you have install your xcode-beta. Install your commands line tools like usual, using the following code on your terminal

xcode-select --install

One you have installed commands line tools is the step to download the new ones

To do this, open your browser and look for apple developer resources download

Screenshot from https://developer.apple.com/xcode/resources/

Select view additional downloads, you will need to logIn in order to continue.

Once you have logIn, look for the file you are interested in, in my case was Additional Tools for Xcode 14 beta 5

Select download and wait.

Once is downloaded if you try to open it, you will see the following content on the folder.

enter image description here

It is time to open xcode

Look for xcode<preferences

enter image description here

Search for Locations. And on command line tools select the ones you just downloaded

enter image description here

Upvotes: 0

Apatoallo
Apatoallo

Reputation: 55

call Xcode.app like this:

sudo xcode-select -s /Applications/Xcode.app

if you're downgrading from Xcode Beta version

Upvotes: 2

JackDao
JackDao

Reputation: 513

I have install 2 Xcode version 10, 11 and can switch them. But both of them have install on Applications. - Applications/Xcode.app - Applications/Xcode 10/Xcode.app May be you should move it to Applications inside folder like me.

Upvotes: 0

KMR
KMR

Reputation: 305

Use this command in terminal to switch xcode:

sudo xcode-select -s /Applications/Xcode-beta.app 

See: https://medium.com/@maximbilan/switch-command-line-tools-to-xcode-beta-2e99c54cb147

Upvotes: 22

Related Questions