如何安装 xCode 命令行工具?如何安装 Xcode 9 beta 和 xCode 8? [英] How do I install xCode command line tools? How to install Xcode 9 beta along with xCode 8?
问题描述
工具可用吗?我有一个苹果开发者帐户,我从 https://developer.apple 下载了 Xcode 9 beta.com/下载/.
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/.
Xcode 9 开发者工具出来了吗?
Are Xcode 9 developer tools out?
推荐答案
安装 Xcode 时,您也将安装命令行工具.您可以通过键入 $ gcc
进行验证.如果您收到类似:clang: error: no input files
的错误消息,则您已经拥有 命令行工具.但只是为了获取信息,如果您需要命令行工具,您可以执行 $ xcode-select --install
.
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 have command line tools. But just for info, you can do $ xcode-select --install
if you want the command line tools.
现在要同时使用 Xcode8
和 Xcode9 Beta
一起,您需要执行以下操作:
Now to use both Xcode8
and Xcode9 Beta
together, you need to do the following:
0) 关闭所有打开的 Xcode 项目并退出 Xcode
1) 将您的 Xcode
(8 将只是您的/Applications 目录中的 Xcode.app)重命名为类似 Xcode8
的名称.
1) Rename your Xcode
(8 which will be just Xcode.app in your /Applications directory) to something like Xcode8
.
2) 输入 $ xattr -d com.apple.quarantine/Users/
.在这里,您需要在输入 $ xattr -d com.apple.quarantine
后将 xcode-beta(xcode9) 拖到终端.现在,将您的 Xcode-beta 移动到您的/Applications 目录并将其重命名为 Xcode
.
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
.
3) 输入 $ sudo xcode-select -s/Applications/Xcode(现在是 9).app/Contents/Developer
.如果你想切换回 8,只需在 Xcode.app
的位置输入与 Xcode8.app
相同的命令.
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.app
in the place of Xcode.app
.
4) 通过键入 $ xcode-select -print-path
验证您使用的是 Xcode 9.您可以看到它会指向 Xcode.app
,它实际上是 Xcode-beta,即 Xcode 9.
Xcode-beta 是 xcode 9.
4) Verify you're using Xcode 9 by typing $ xcode-select -print-path
. You can see that it'll point to Xcode.app
which actually is Xcode-beta, i.e., Xcode 9.
Xcode-beta is xcode 9.
这篇关于如何安装 xCode 命令行工具?如何安装 Xcode 9 beta 和 xCode 8?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!