使用 OS X El Capitan 安装 xcode 命令行工具
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40348018/
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
Install xcode command line tools with OS X El Capitan
提问by helloB
I am trying to install xcode command line tools on OS X El Capitan in order to be able to install homebrew
. So far, all the advice I've looked at (e.g. http://railsapps.github.io/xcode-command-line-tools.html, http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/, Command Line Tools not working - OS X El Capitan/ macOS-sierra) are not working. Is there any alternate route anyone can recommend? When I try the recommended trouble shooting from the posts above, I get nonsense errors:
我正在尝试在 OS X El Capitan 上安装 xcode 命令行工具,以便能够安装homebrew
. 到目前为止,我看过的所有建议(例如http://railsapps.github.io/xcode-command-line-tools.html,http : //osxdaily.com/2014/02/12/install-command -line-tools-mac-os-x/,命令行工具不工作 - OS X El Capitan/ macOS-sierra)不工作。有人可以推荐任何替代路线吗?当我尝试从上面的帖子中推荐的故障排除时,我得到了无意义的错误:
xcode-select: command not found
ip-10-4-89-242 ~ $ gcc
gcc: fatal error: no input files
compilation terminated.
ip-10-4-89-242 ~ $ xcode-select --install
xcode-select: command not found
xcode-select: command not found
ip-10-4-89-242 ~ $ gcc
gcc: fatal error: no input files
compilation terminated.
ip-10-4-89-242 ~ $ xcode-select --install
xcode-select: command not found
回答by VizJS
It seems likely that xcode-select isn't installed until XCode is installed, considering that it's intended purpose is to link to / switch between already installed versions of XCode tooling.
考虑到它的预期目的是链接到/在已安装的 XCode 工具版本之间切换,似乎在安装 XCode 之前不会安装 xcode-select。
To solve this, first install XCode from Apple. Then you can connect the command line tools from within the XCode app preferences panel, or via xcode-select in Terminal, as you prefer. Either way, you will be prompted to agree to Apple's XCode terms and conditions.
要解决这个问题,首先从 Apple 安装 XCode。然后,您可以根据自己的喜好从 XCode 应用程序首选项面板中或通过终端中的 xcode-select 连接命令行工具。无论哪种方式,系统都会提示您同意 Apple 的 XCode 条款和条件。
Once you install XCode and agree to the terms, homebrew will be able to use the XCode command line tools.
安装 XCode 并同意条款后,自制软件将能够使用 XCode 命令行工具。
Apple provides Xcode for download via the App Store, as well as via their developer site, if you set up an Apple Developer account.
如果您设置了 Apple Developer 帐户,Apple 会通过App Store以及他们的开发者网站提供 Xcode 下载。