如何安装 xCode 命令行工具?如何安装 Xcode 9 beta 和 xCode 8?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38162836/
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 18:19:17  来源:igfitidea点击:

How do I install xCode command line tools? How to install Xcode 9 beta along with xCode 8?

xcodebetaxcode8

提问by Evan Conrad

Are the tools available? I have an apple developer account and I have Xcode 9 beta downloaded which I got from https://developer.apple.com/download/.

工具是否可用?我有一个苹果开发者帐户,我从https://developer.apple.com/download/下载了 Xcode 9 beta 。

Are Xcode 9 developer tools out?

Xcode 9 开发者工具出来了吗?

回答by Dershowitz123

When you install Xcode, you'll install command line tools too. You can verify by typing $ gcc. If you get an error like:clang: error: no input files, you already havecommand line tools. But just for info, you can do $ xcode-select --installif you want the command line tools.

当您安装 Xcode 时,您还将安装命令行工具。您可以通过键入来验证$ gcc。如果您收到类似的错误:clang: error: no input files,则您已经拥有命令行工具。但仅供参考,$ xcode-select --install如果您需要命令行工具,您可以这样做。

Now to use both Xcode8and Xcode9 Betatogether, you need to do the following:

现在同时使用Xcode8Xcode9 Beta在一起,你需要做到以下几点:

0) Close all open Xcode projects and quit Xcode

0) 关闭所有打开的 Xcode 项目并退出 Xcode

1) Rename your Xcode(8 which will be just Xcode.app in your /Applications directory) to something like Xcode8.

1) 将您的Xcode(8,在您的 /Applications 目录中只是 Xcode.app )重命名为Xcode8.

2) Type in $ xattr -d com.apple.quarantine /Users/<your_user_name>/<the downloaded directory>/Xcode-beta.app. Here you need to drag your xcode-beta(xcode9) to your terminal once you just type $ xattr -d com.apple.quarantine. Now, move your Xcode-beta into your /Applications directory and rename it as Xcode.

2) 输入$ xattr -d com.apple.quarantine /Users/<your_user_name>/<the downloaded directory>/Xcode-beta.app. 在这里,您只需输入$ xattr -d com.apple.quarantine. 现在,将您的 Xcode-beta 移动到您的 /Applications 目录并将其重命名为Xcode.

3) Type in $ sudo xcode-select -s /Applications/Xcode(which is 9 now).app/Contents/Developer. If you want to switch back to 8, just type in the same command with Xcode8.appin the place of Xcode.app.

3) 输入$ sudo xcode-select -s /Applications/Xcode(which is 9 now).app/Contents/Developer. 如果你想切换回8,只是在同一个命令与键入Xcode8.app在的地方Xcode.app

4) Verify you're using Xcode 9 by typing $ xcode-select -print-path. You can see that it'll point to Xcode.appwhich actually is Xcode-beta, i.e., Xcode 9.
Xcode-beta is xcode 9.

4) 输入$ xcode-select -print-path. 你可以看到它会指向Xcode.app哪个实际上是 Xcode-beta,即 Xcode
9。Xcode-beta 是 xcode 9。