我有一个OS X 10.8.2的macbook pro.XCode已安装.我知道它出现在Applications目录中.在/ usr/bin中还有xcodebuild和xcode-select文件我需要知道是否安装了命令行工具.有命令吗?我该怎么做才能看到是否安装了XCode CLT,如果是,则查找安装的版本?
jno*_*ack 89
只需输入命令行gcc
或make
命令行!OSX会知道您没有命令行工具并提示您安装它们!
要检查它们是否存在,xcode-select -p
返回值将是2
不存在的,0
如果它们存在(以及目录).
使用 pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
选项1: Rob Napier建议使用pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
,这可能更干净.
选项2:检查内部/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist
是否有参考com.apple.pkg.DeveloperToolsCLI
,它将列出版本4.5.0
.
xcode-select -p 1>/dev/null;echo $?
Run Code Online (Sandbox Code Playgroud)
phy*_*att 77
以下是有些人可能需要的新Mac上的一些额外步骤.这为@ jnovack的优秀答案增添了一点点.
更新:设置时的一些其他说明:
确保您的管理员用户有密码.尝试启用root用户时,空白密码不起作用.
System Preferences > Users and Groups > (select user) > Change password
Run Code Online (Sandbox Code Playgroud)
然后启用root,dsenableroot
在终端中运行:
$ dsenableroot
username = mac_admin_user
user password:
root password:
verify root password:
dsenableroot:: ***Successfully enabled root user.
Run Code Online (Sandbox Code Playgroud)
输入admin用户的密码,然后输入新的启用的root密码两次.
下一个类型:
sudo gcc
Run Code Online (Sandbox Code Playgroud)
要么
sudo make
Run Code Online (Sandbox Code Playgroud)
它会响应以下内容:
WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.
To proceed, enter your password, or type Ctrl-C to abort.
Password:
You have not agreed to the Xcode license agreements. You must agree to
both license agreements below in order to use Xcode.
Run Code Online (Sandbox Code Playgroud)
当提示您显示许可协议时按Enter键.
Hit the Enter key to view the license agreements at
'/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
IMPORTANT: BY USING THIS SOFTWARE, YOU ARE AGREEING TO BE BOUND BY THE
FOLLOWING APPLE TERMS:
//...
Run Code Online (Sandbox Code Playgroud)
按q
退出许可协议视图.
By typing 'agree' you are agreeing to the terms of the software license
agreements. Type 'print' to print them or anything else to cancel,
[agree, print, cancel]
Run Code Online (Sandbox Code Playgroud)
类型agree
.然后它将结束:
clang: error: no input files
Run Code Online (Sandbox Code Playgroud)
这基本上意味着你没有给make
或gcc
任何输入文件.
这是支票的样子:
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)
对于小牛队来说,现在有点不同了.
找不到工具时,这是命令pkgutil
命令返回的内容:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
Run Code Online (Sandbox Code Playgroud)
要安装命令行工具,这可以很好地从终端,有一个很好的gui和一切.
$ xcode-select --install
Run Code Online (Sandbox Code Playgroud)
http://macops.ca/installing-command-line-tools-automatically-on-mavericks/
找到它们后,这就是pkgutil
命令返回的内容:
$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 5.0.1.0.1.1382131676
volume: /
location: /
install-time: 1384149984
groups: com.apple.FindSystemFiles.pkg-group com.apple.DevToolsBoth.pkg-group com.apple.DevToolsNonRelocatableShared.pkg-group
Run Code Online (Sandbox Code Playgroud)
此命令在安装之前和之后返回相同的命令.
$ pkgutil --pkg-info=com.apple.pkg.DeveloperToolsCLI
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
Run Code Online (Sandbox Code Playgroud)
此外,我之前选择并安装在xcode的下载部分中的CLT组件,但似乎它没有进入终端......
希望有所帮助.
use*_*766 26
要检查命令行工具是否已安装,请运行:
xcode-select --version
// if installed you will see the below with the version found in your system
// xcode-select version 1234.
Run Code Online (Sandbox Code Playgroud)
如果未安装命令行工具,请运行:
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
Pau*_*ood 14
在 macOS Catalina以及可能的一些早期版本中,您可以使用以下命令找出命令行工具的安装位置:
xcode-select -p
又名 xcode-select --print-path
如果已安装,它将响应如下:
/Library/Developer/CommandLineTools
要找出您在那里安装了哪个版本,您可以使用:
xcode-select -v
又名 xcode-select --version
这将返回如下内容:
xcode-select version 2370.
但是,如果您尝试将其升级到最新版本(假设已安装),请使用以下命令:
xcode-select --install
您将收到以下回复:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
这相当错误地给人的印象是您需要使用 Spotlight 找到称为“软件更新”的东西。实际上,您需要在终端中继续,并使用它:
softwareupdate -i -a
又名 softwareupdate --install --all
它试图更新它可以更新的所有内容,并且很可能会响应:
Software Update Tool
Finding available software
No new software available.
Run Code Online (Sandbox Code Playgroud)
要了解您的机器上安装了哪些版本的不同 Apple SDK,请使用以下命令:
xcodebuild -showsdks
sah*_*rar 12
在macOS Sierra(10.12):
运行以下命令以查看是否已安装CLT:
xcode-select -p
Run Code Online (Sandbox Code Playgroud)
如果已经安装了CLT,这将返回工具的路径.像这样的东西 -
/Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)运行以下命令以查看CLT的版本:
pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
Run Code Online (Sandbox Code Playgroud)
这将返回版本信息,输出将是这样的 -
package-id: com.apple.pkg.CLTools_Executables
version: 8.2.0.0.1.1480973914
volume: /
location: /
install-time: 1486372375
Run Code Online (Sandbox Code Playgroud)小智 12
我认为最简单的方法是让我找到命令行工具是否已安装及其版本,而不管 macOS 版本是什么
$brew config
Run Code Online (Sandbox Code Playgroud)
macOS:10.14.2-x86_64
CLT:10.1.0.0.1.1539992718
Xcode:10.1
当您正确安装了命令行工具并正确设置了路径时。
早些时候我得到如下输出
macOS: 10.14.2-x86_64
CLT: N/A
Xcode: 10.1
尽管有 gcc 并且使工作正常且低于输出,但 CLT 仍显示为 N/A
$xcode-select -p
/Applications/Xcode.app/Contents/Developer
$pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
$brew doctor
Your system is ready to brew.
Run Code Online (Sandbox Code Playgroud)
最后执行 xcode-select --install 解决了我的 brew 无法找到用于安装软件包的 CLT 问题,如下所示。
Installing sphinx-doc dependency: python
Warning: Building python from source:
The bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
131558 次 |
最近记录: |