无法安装命令行工具,“xcode-select --install”不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20229437/
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
Can't install Command Line Tool, "xcode-select --install" doesn't work
提问by Giovanni
I don't know how to install the Command Line Tools on OSX Mavericks. Or better: I know how to do it (I just did it on another MacBook), but something goes wrong this time.
我不知道如何在 OSX Mavericks 上安装命令行工具。或者更好:我知道怎么做(我只是在另一台 MacBook 上做的),但是这次出了点问题。
What happened:
发生了什么:
- I Install Homebrew on OSX Mavericks
- Homebrew ask me to intall the CLT and run a GUI for that
- I make a mistake: I install XCode instead of CLT, but I find that the CLT was not installed with it
- 我在 OSX Mavericks 上安装 Homebrew
- Homebrew 要求我安装 CLT 并为此运行 GUI
- 我犯了一个错误:我安装了 XCode 而不是 CLT,但我发现 CLT 没有安装
Now, when I write
现在,当我写
brew doctor
brew doctor
I get this
我明白了
Warning: No developer tools installed.
You should install the Command Line Tools.
Run `xcode-select --install` to install them.
警告:未安装开发人员工具。
您应该安装命令行工具。
运行 `xcode-select --install` 来安装它们。
I write what it says, but I get always
我写它所说的,但我总是得到
Usage: xcode-select -print-path
or: xcode-select -switch
or: xcode-select -version
Arguments:
-print-path Prints the path of the current Xcode folder
-switch xcode_folder_path Sets the path for the current Xcode folder
-version Prints xcode-select version information
用法:xcode-select -print-path
或:xcode-select -switch
或:xcode-select -version
参数:
-print-path 打印当前 Xcode 文件夹
的路径 -switch xcode_folder_path 设置当前 Xcode 文件夹的路径
-version打印 xcode-select 版本信息
I think I should instead see that GUI (screenshots) that I saw at the beginning and that let me install the CLT.
我想我应该看到我在开始时看到的GUI(屏幕截图)并让我安装 CLT。
Does anyone know how can I run that GUI again?
有谁知道我怎样才能再次运行那个 GUI?
回答by zaph
Try downloading directly from the Apple Developer Tools site: https://developer.apple.com/downloads/index.action.
This requires signing in with a developer account.
尝试直接从 Apple Developer Tools 站点下载:https: //developer.apple.com/downloads/index.action。
这需要使用开发者帐户登录。
回答by Richard Guay
I came across this issue when I removed Xcode from my laptop (Not enough disk space) and wanted to just install the commandline tools. It installed, but did not fix the Xcode-select path. Using the information above, I then ran:
当我从笔记本电脑中删除 Xcode(磁盘空间不足)并只想安装命令行工具时,我遇到了这个问题。它已安装,但没有修复 Xcode-select 路径。使用上面的信息,我然后运行:
xcode-select -s /Library/Developer/CommandLineTools
Homebrew is now working great with just the command line tools and I have 9 GB back! Therefore, if you have removed Xcode from your system and just installed the command line tools, you will have to manually run the above command line.
Homebrew 现在只使用命令行工具就可以很好地工作了,我有 9 GB 回来了!因此,如果您已经从系统中删除了 Xcode 并且刚刚安装了命令行工具,则必须手动运行上述命令行。
回答by Sreekanth P M
If you are not able to install the XCode CLI using terminal command
如果您无法使用终端命令安装 XCode CLI
sudo xcode-select --install
Just download the command line tool from Apple developer website (below link)
https://developer.apple.com/download/more/
And install it manually.
只需从 Apple 开发者网站(下方链接)下载命令行工具
https://developer.apple.com/download/more/
并手动安装。
回答by Magne
The probem you're having might be that you have an old version of xcode-select
which doesn't have the --install
option. I had the same problem, and running xcode-select --version
revealed I had version 2003, which is an old one.
您遇到的问题可能是您有一个xcode-select
没有--install
选项的旧版本。我遇到了同样的问题,运行后xcode-select --version
发现我的版本是 2003,这是一个旧版本。
What you probably need to do is to restore the original xcode-select system shim that came with your OSX Mavericks, so it will refer correctly to any new xcode or CLT versions you install, instead of being stuck on the old version forever.
您可能需要做的是恢复您的 OSX Mavericks 附带的原始 xcode-select 系统垫片,这样它就会正确地引用您安装的任何新的 xcode 或 CLT 版本,而不是永远停留在旧版本上。
This blog post details the problem a bit more: http://magnemg.tumblr.com/post/113251602430/how-to-completely-uninstall-osx-gcc-installer
这篇博文详细介绍了这个问题:http: //magnemg.tumblr.com/post/113251602430/how-to-completely-uninstall-osx-gcc-installer
Here is the torrent with the original OSX Mavericks system shims (extracted from the original installer), so you don't have to download and reinstall the entire OS again: https://archive.org/details/completely_uninstall_osx-gcc-installer
这是原始 OSX Mavericks 系统垫片的种子(从原始安装程序中提取),因此您不必再次下载并重新安装整个操作系统:https: //archive.org/details/completely_uninstall_osx-gcc-installer
Hope this helps anyone else who might stumble upon this question.
希望这可以帮助任何可能偶然发现这个问题的人。