xcode 铿锵:错误:无法找到 xcodebuild

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

clang: error: unable to locate xcodebuild

cxcodemacosmacos-high-sierracommand-line-tool

提问by ctt25

I am using a mac version 10.13.6.

我使用的是 Mac 版本 10.13.6。

I want to compile C programs through the terminal. I've downloaded Xcode and the command line tools. When I type clang --versionin the terminal, I get the following two error messages:

我想通过终端编译C程序。我已经下载了 Xcode 和命令行工具。当我clang --version在终端中输入时,我收到以下两条错误消息:

clang: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly!

clang: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch

clang: 错误:无法找到 xcodebuild,请确保 Xcode 文件夹的路径设置正确!

clang:错误:您可以使用 /usr/bin/xcode-select -switch 设置 Xcode 文件夹的路径

I did some googling and found a fix here. The solution is to run the following line in terminal:

我做了一些谷歌搜索,并在这里找到了解决方法。解决方案是在终端中运行以下行:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

Which I did. But when I enter clang --versionafter doing this, I get exactly the same two errors. What's going on?

我做的。但是当我clang --version这样做后进入时,我得到了完全相同的两个错误。这是怎么回事?

NB: very very new to this so please keep that in mind when answering! cheers

注意:对此非常新,所以请在回答时记住这一点!干杯

回答by AdamWinsche

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 

worked like a charm for me

对我来说就像一种魅力