安装Xcode命令行工具 [英] Installing Xcode command line tools
问题描述
我执行了macOS Mojave 10.14的全新安装.之后,我立即从Mac App Store安装了Xcode版本10.0(10A255).
I performed a fresh install of macOS Mojave 10.14. Immediately after that I installed Xcode Version 10.0 (10A255) from the Mac App Store.
现在,我希望安装需要安装Xcode命令行工具的Homebrew.我的理解是,安装Xcode还会安装命令行工具.还是不?
Now, I wish to install Homebrew which requires Xcode command line tools to be installed. My understanding is that installing Xcode also installs the command line tools. Or not?
根据此答案,我检查了是否通过运行以下命令安装了命令行工具:
As per this answer, I checked if the command line tools are installed by running:
xcode-select -p
如下所示打印了Developer目录的路径:
which printed the path for the Developer directory as follows:
/Applications/Xcode.app/Contents/Developer
如答案中所建议,我还通过运行以下命令验证了返回值:
As suggested in the answer, I also verified the return value by running:
echo $?
重新调整了0
.
我也跑了gcc
和make
,bash能够找到并执行它们.
I also ran, gcc
and make
and bash was able to locate and execute them.
到目前为止,我确信已经安装了Xcode命令行工具.现在,当我执行时:
Thus far I am convinced that the Xcode command line tools are installed. Now when I execute:
xcode-select --install
我收到此警报:
这种差异的可能原因是什么?这将两次安装Xcode命令行工具吗?还是覆盖现有安装?
What's the probable reason for this disparity? Will this install Xcode command line tools twice? Or overwrite the existing installation?
据我了解,可以无需安装即可安装Xcode命令行工具.另外,根据我以前的经验,如果不是通过Xcode单独安装命令行工具(通过运行xcode-select --install
),Homebrew不会检测到它们,即,运行brew config
时,CLT:
的值显示为N/A
.
As I understand, Xcode command line tools can be installed without installing Xcode. Also, from my previous experience, if the command line tools aren't installed separately from Xcode (by running xcode-select --install
), they are not detected by Homebrew, i.e. when running brew config
, the value for CLT:
is shown as N/A
.
这是完整的图片(对双关语):
Here's the complete picture (pardon the pun):
尽管我是在macOS Mojave的背景下进行讨论的,但对于以前版本的macOS,问题仍然相同.
Although I am talking in context of macOS Mojave, the question remains the same with regard to previous versions of macOS.
在这里采取什么明智的方法?
What is the advisable approach to take here?
注意:安装Xcode之后,我启动了该代码,接受了许可协议,并使其完成了安装其他工具的过程(这是一次性的活动).
Note: After installing Xcode, I launched it, accepted license agreement and let it finish its run of installing additional tools (which is a one time activity).
推荐答案
在为我工作之后,只有命令行工具也可以安装.
Following worked for me, only command line tool can also me installed.
更新为 Mojave 10.14 之后,请转到 https://developer. apple.com/download/more/搜索"命令行",然后
After you updated to Mojave 10.14 Go to https://developer.apple.com/download/more/ search for "command line" then
下载" MacOS 10.14的命令行工具"
下载dmg后,请安装软件包.
Once dmg is downloaded install the package.
验证软件包安装
这篇关于安装Xcode命令行工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!