如何在我的 mac 中将 xcode 版本设置为默认版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25910796/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 17:59:17  来源:igfitidea点击:

How to set xcode version as default in my mac?

iphonexcode

提问by user1954352

Right now I have xcode 6.0(Beta) as a default version of my xcode.

现在我有 xcode 6.0(Beta) 作为我的 xcode 的默认版本。

Now today I installed xcode 6 from app store but I want to set xcode 6 as a default version.

现在我从应用商店安装了 xcode 6,但我想将 xcode 6 设置为默认版本。

How can I set it?

我该如何设置?

Thanks in advance.

提前致谢。

回答by Alex

you could set the desired Xcode using this in the terminal:

您可以在终端中使用此设置所需的 Xcode:

sudo xcode-select -switch <path/to/>Xcode.app

also, for more info, click here

此外,有关更多信息,请单击此处

回答by Ajith R Nayak

It should be easy.

这应该很容易。

Solution 1:

解决方案1:

  • Right click(or Control+ Click) on Xcode project file (.xcodeproj).
  • Hover over 'Open with' and you will find all the Xcode apps from Applications directory listed.
  • 右键单击(或Control+ 单击)Xcode 项目文件(.xcodeproj)。
  • 将鼠标悬停在“打开方式”上,您将找到列出的 Applications 目录中的所有 Xcode 应用程序。

Screen Shot of multiple Xcode apps

多个 Xcode 应用程序的屏幕截图

  • Now, hold down the Optionkey so that the “Open With” menu becomes “Always Open With”.
  • Continue to hold Optionand select the Xcode version you want to set as the default for this file.
  • 现在,按住Option键,使“打开方式”菜单变为“始终打开方式”。
  • 继续按住Option并选择要设置为该文件默认值的 Xcode 版本。

Solution 2:

解决方案2

Another way to apply this change to all the similar files is by clicking "Get info" and then making necessary change in 'Open With' section.

将此更改应用于所有类似文件的另一种方法是单击“获取信息”,然后在“打开方式”部分进行必要的更改。

enter image description here

在此处输入图片说明

回答by Ruchira Randana

Not directly related, however I assume most of you'd find this useful. Here is a linkshowing the command line FAQs.

没有直接关系,但是我认为你们大多数人会发现这很有用。这是显示命令行常见问题解答的链接

The most 2 useful commands are.

最有用的 2 个命令是。

  1. Printing the version of Xcode currently used by my tools
  1. 打印我的工具当前使用的 Xcode 版本

xcode-select --print-path

xcode-select --print-path

  1. Select the default Xcode for your command-line tools
  1. 为您的命令行工具选择默认的 Xcode

sudo xcode-select -switch Xcode.app

E.g: sudo xcode-select -switch /Applications/Xcode5.1.1/Xcode.app

须藤 xcode-select -switch Xcode.app

例如: sudo xcode-select -switch /Applications/Xcode5.1.1/Xcode.app

回答by Anoop Vaidya

In 10.10 you should use (Assuming you've installed few versions of Xcode as Xcode6.1, Xcode6.2 and Xcode6.3, and want to make Xcode6.3 as default one).

在 10.10 中,您应该使用(假设您已经安装了几个版本的 Xcode,如 Xcode6.1、Xcode6.2 和 Xcode6.3,并且希望将 Xcode6.3 作为默认版本)。

sudo xcode-select --switch /Applications/Xcode6.3.app

This comes handy with some 3rd party applications which fails to reset the path from OSX like SVNX.app

这对于某些无法从 OSX 重置路径(如 SVNX.app)的 3rd 方应用程序很方便

回答by rahul.sapkal23

This works for me I'm using vanilla titanium CLI.

这对我有用,我正在使用香草钛 CLI。

Switch to desired Xcode version followed by ti setupfor ios

切换到所需的 Xcode 版本,然后是ti setupforios

sudo xcode-select -switch /path/to/Xcode.app/Contents/Developer/

ti setup ios

须藤 xcode-select -switch /path/to/Xcode.app/Contents/Developer/

ti 设置 ios

回答by Rody Davis

If you do a lot of work in both the current and beta version of Xcode run sudo xcode-select --switch /Applications/Xcode.appto select the default xcode and rename the beta Xcode to XcodeBeta.appor Xcode10.app.

如果您在 Xcode 的当前版本和 beta 版本中都做了很多工作,请运行sudo xcode-select --switch /Applications/Xcode.app以选择默认 xcode 并将 beta Xcode 重命名为XcodeBeta.appXcode10.app

Whenever you want to upgrade just rename the Xcode and restart terminal.

每当您想升级时,只需重命名 Xcode 并重新启动终端即可。