手动安装 Xcode 命令行工具不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23260748/
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
Manual Install of Xcode command line tools not working
提问by user3674720
I've manually installed the Xcode command line tools from the Apple website, and I went through the install process but it doesn't seem to be working. I ran this from the terminal to see if it installed:
我已经从 Apple 网站手动安装了 Xcode 命令行工具,并完成了安装过程,但它似乎不起作用。我从终端运行它以查看它是否安装:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.1.0.0.1.1396320587
volume: /
location: /
install-time: 1398301024
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group
So it looks like the command line tools have installed, but when I run this:
所以看起来命令行工具已经安装,但是当我运行这个时:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ xcode-select --install
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ xcode-select --install
A popup says: The "xcode-select" command requires the command line developer tools. Would you like to install the tools now?
弹出窗口说:“xcode-select”命令需要命令行开发人员工具。您想现在安装这些工具吗?
I clicked install and then it said: Can't install the software because it is not currently available from the Software Update server.
我单击了安装,然后它说:无法安装该软件,因为它当前无法从软件更新服务器获得。
I've read on other answers that the solution is to do a manual install, but I just did that so I don't understand why it's not working. Also, in Xcode downloads, it's not showing the Command Line Tools.
我已经阅读了其他答案,该解决方案是手动安装,但我只是这样做了,所以我不明白为什么它不起作用。此外,在 Xcode 下载中,它没有显示命令行工具。
I've tried installing it manually many times so I don't know why it's not working.
我试过手动安装它很多次,所以我不知道为什么它不起作用。
Installing Jekyll still won't work:
安装 Jekyll 仍然不起作用:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ sudo gem install jekyll
Password:
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
EDIT: echo $PATH returns this:
Zach-Boyette-MacBook-Pro-2:~ zachboyette$ echo $PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/zachboyette/.rvm/bin
回答by Argenis
Command Line Tools are not included in XCode 5.1.1 You have to install it manually, BUT DON'T USE "xcode-select --install". It does not work.
XCode 5.1.1 中不包含命令行工具您必须手动安装它,但不要使用“xcode-select --install”。这是行不通的。
- Open Xcode app.
- Click on Xcode > Open Developer Tools > More Developers Tools. That will take you to Downloads for Apple Developers web site. Use your AppStore Id to login.
- Download Command Line Tools for your Mac OS X version.
- 打开 Xcode 应用程序。
- 单击 Xcode > 打开开发者工具 > 更多开发者工具。这将带您进入 Apple Developers 网站的下载。使用您的 AppStore ID 登录。
- 下载适用于您的 Mac OS X 版本的命令行工具。
回答by David Hutchison
I have stumbled across this issue before when I completely hosed my development environment by deleting an ancient Xcode version.
之前,当我通过删除一个古老的 Xcode 版本完全处理我的开发环境时,我偶然发现了这个问题。
Have you tried running sudo xcode-select -r
to clean up? This sorted my problem.
你试过跑步sudo xcode-select -r
清理吗?这解决了我的问题。
From the man page:
从手册页:
-r, --reset
Unsets any user-specified developer directory, so that the
developer directory will be found via the default search mecha-
nism. This command must be run with superuser permissions (see
sudo(8)), and will affect all users on the system.
回答by AJ.
The easiest work around is to install the XCode app from the App Store then open XCode and agree to the Terms and Conditions.
最简单的解决方法是从 App Store 安装 XCode 应用程序,然后打开 XCode 并同意条款和条件。
From there the Command Line Developer Tools package can be installed on using xcode-select --install
or by trying to use any command line developer tool in Terminal like git
.
从那里可以安装命令行开发人员工具包,使用xcode-select --install
或尝试使用终端中的任何命令行开发人员工具,如git
.