简体   繁体   English

如果我已经有 Xcode,是否需要单独为 Xcode 安装命令行工具

[英]Do i need to install Command Line Tools for Xcode separately if i already have Xcode

I tried to install gcc 5.2 (already installed dependencies successfully) from source file on my computer one week ago, but it failed at make phase or make install phase because of missing some ****.h files, whatever, i can not remember clearly.一周前我尝试从我的计算机上的源文件安装 gcc 5.2(已经成功安装依赖项),但是由于缺少一些 ****.h 文件,它在 make 阶段或 make install 阶段失败,无论如何,我不记得了清楚地。

I searched the reason online, and looks like it is because i did not installed Command Line Tools for Xcode. But I already have Xcode 7.1.1 and i think it includes the Command Line Tool.我在网上搜索了原因,看起来是因为我没有为 Xcode 安装命令行工具。但是我已经有 Xcode 7.1.1,我认为它包含命令行工具。 I find it from File -> New -> project -> OS X Application -> Command Line Tool.我从文件 -> 新建 -> 项目 -> OS X 应用程序 -> 命令行工具中找到它。 I can also use gcc --version in the terminal.我也可以在终端中使用 gcc --version。

So do i need to install Command Line Tools separately?那么我需要单独安装命令行工具吗? If I need, and why?如果我需要,为什么?

did you try to download it like described in the attached images: 您是否尝试按照所附图片中的说明进行下载:

在此处输入图片说明

在此处输入图片说明

If you have installed Xcode you have installed command line tools too. 如果您已经安装了Xcode,那么您也已经安装了命令行工具。 Xcode installs command line tools automatically the first time you open it ("Installing additional components" is the message you see on the screen). 首次打开Xcode时,它会自动自动安装命令行工具(“安装其他组件”是您在屏幕上看到的消息)。

Actually xcode cannot function without the command line tools (build, git etc). 实际上,如果没有命令行工具(build,git等),xcode便无法运行。

short answer: no, you don't.简短的回答:不,你没有。

this is the official description for the Command Line Tools for Xcode (from the https://developer.apple.com/download/all/ ):这是 Xcode 命令行工具的官方描述(来自https://developer.apple.com/download/all/ ):

This package enables UNIX-style development via Terminal by installing command line developer tools, as well as macOS SDK frameworks and headers.这个 package 通过安装命令行开发工具以及 macOS SDK 框架和标头,通过终端启用 UNIX 风格的开发。 Many useful tools are included, such as the Apple LLVM compiler, linker, and Make.包括许多有用的工具,例如 Apple LLVM 编译器、linker 和 Make。 If you use Xcode, these tools are also embedded within the Xcode IDE.如果你使用Xcode,这些工具也嵌入在Xcode IDE内。


long answer: it depends.长答案:这取决于。

for example, if you're using homebrew package manager it requires CLT (from homebrew member comment https://github.com/Homebrew/brew/issues/10714#issuecomment-786663987 )例如,如果您使用homebrew package 管理器,则需要 CLT(来自自制软件会员评论https://github.com/Homebrew/brew/issues/10714#issuecomment-786663987

The reason we need the Command Line Tools rather than just Xcode.app is for a few reasons:我们需要命令行工具而不仅仅是 Xcode.app 的原因有以下几个:

  • The CLT contains more SDKs than Xcode - Xcode usually only contains one SDK, and it may be newer than your OS, while the CLT always has a compatible SDK. Having a matching SDK is very important for some formulae. CLT 包含的 SDK 比 Xcode 多 - Xcode 通常只包含一个 SDK,它可能比您的操作系统更新,而 CLT 总是有一个兼容的 SDK。匹配 SDK 对于某些公式非常重要。
  • The CLT is in a fixed location /Library/Developer/CommandLineTools while Xcode is not. CLT 位于固定位置 /Library/Developer/CommandLineTools 而 Xcode 则不是。 This matters as some formulae (including Python) bake in paths into files at compile-time - if they pointed to Xcode then it will only work for people who have Xcode installed in the same place.这很重要,因为一些公式(包括 Python)在编译时将路径烘焙到文件中——如果它们指向 Xcode,那么它只适用于在同一位置安装了 Xcode 的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我有 Xcode 命令行工具,我真的需要 Xcode GUI 来开发 iOS 应用程序吗? - I have Xcode command line tools, do I really need the Xcode GUI to develop iOS apps? 具有Xcode 7-需要6.4与命令行工具 - Have xcode 7 - need 6.4 with command line tools XCode:使用命令行工具,如何从文件夹创建git并将其导入项目中 - XCode : Using the command line tools, how do I create a git from a folder and import that on a project Mac 使用 iOS SDK 为 xcode 安装命令行工具 - Mac install command line tools for xcode with iOS SDK Xcode 构建失败并且重复需要命令行开发工具安装 - Xcode build fails and repetitive requires command line developer tools install Xcode命令行安装到设备 - Xcode command line install to device Xcode 5.0安装命令行工具时出错 - Xcode 5.0 Error installing command line tools 如何在Xcode中创建一个项目,允许我用Objective-C ++编写,并有一个命令行界面? - How do I create a project in Xcode that allows me to write in Objective-C++, and have a command-line interface? xCode命令行工具已安装,但不可见 - xCode command line tools installed, but not visible 我已经用Java开发了一个应用程序,如何在xcode模拟器中打开它 - i have already developed an app in java how do i open it in xcode simulator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM