14

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

  • Xcode 9.4 command line tools (bundled with Xcode9.4, it installed at /Applications/Xcode.app/Contents/Developer)

  • Command line tools beta1 for Xcode 10 (not bundled with Xcode, it installed at /Library/Developer)

KiYugadgeter
  • 3,796
  • 7
  • 34
  • 74
  • The title of the cli tools is "Command line tools beta1 for Xcode 10" — so wouldn't that more or less indicate you need to use Xcode 10? – l'L'l Jun 05 '18 at 19:07
  • Stable version of Command line tools is able to install without xcode. (`xcode-select --install`) so I think command line tools is not require installing xcode. – KiYugadgeter Jun 06 '18 at 00:24
  • Have you tried switching from the command line? See [this tech note](https://developer.apple.com/library/archive/technotes/tn2339/_index.html#//apple_ref/doc/uid/DTS40014588-CH1-HOW_DO_I_SELECT_THE_DEFAULT_VERSION_OF_XCODE_TO_USE_FOR_MY_COMMAND_LINE_TOOLS_) – Joakim Danielson Jun 06 '18 at 06:31
  • I think you should look to the answer here [How to switch between multiple Command Line Tools installations in Mac OS X (without installing XCode)](https://stackoverflow.com/a/51665704/5405601) – Eligio Mariño Oct 04 '18 at 20:54

6 Answers6

18

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

olinox14
  • 6,177
  • 2
  • 22
  • 39
KMR
  • 265
  • 3
  • 9
2

call Xcode.app like this:

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

if you're downgrading from Xcode Beta version

Paul Roub
  • 36,322
  • 27
  • 84
  • 93
Apatoallo
  • 45
  • 3
2

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.

0

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.

JackDao
  • 433
  • 4
  • 10
0

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

Iker Solozabal
  • 1,232
  • 11
  • 16
0
$ 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

user16217248
  • 3,119
  • 19
  • 19
  • 37