我如何查看是否已安装Xcode命令行工具?

19 浏览
0 Comments

我如何查看是否已安装Xcode命令行工具?

我需要使用gdb。\n

ps-MacBook-Air:AcoustoExport pi$ gdb
-bash: gdb: command not found
ps-MacBook-Air:AcoustoExport pi$ sudo find / -iname "*gdb*"
Password:
/usr/local/share/gdb
/usr/local/Cellar/isl/0.12.1/share/gdb
:

\n以及:\n

ps-MacBook-Air:AcoustoExport pi$ ls -la /usr/local/share/gdb
lrwxr-xr-x   1 pi    admin   30 14 Jan 22:01 gdb -> ../Cellar/isl/0.12.1/share/gdb

\n对于这个,我不太确定该怎么办,显然这是由homebrew安装的东西。我不知道它为什么在那里,也不知道我是否可以使用它。它没有在搜索路径中。\n所以我想我需要Xcode命令行工具。\nXcode is not currently available from the Software Update server\n^ 这正是我目前的问题。对该问题的评论说“如果你已经安装了它们,你可能会遇到这个错误。”\n但是我如何检查我是否已经安装了它们?

0
0 Comments

如何查看是否安装了Xcode命令行工具?

首先,确保您是否已经下载了Xcode命令行工具。打开终端应用程序,并输入$ gcc。如果您尚未安装,您将收到一个警告。

您可以通过以下命令验证是否已安装Xcode命令行工具:

$ xcode-select -p
/Library/Developer/CommandLineTools

为了确保,请输入$ gcc --version

当您输入$ gcc --version时,您会得到什么结果?您是否得到类似于以下内容:--prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)?

不,我得到的是--prefix=/Applications/Xcode.app/Contents/Developer/usr。其余部分与您的打印输出相同。

您可以阅读更多关于此过程的信息:Xcode command line tools for Mavericks

0
0 Comments

如何判断是否安装了Xcode命令行工具?

在没有安装完整的Xcode的情况下,你可以使用以下命令来获取Xcode版本:

pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version

根据Ask Different上对于“确定Xcode命令行工具版本”的回答:

注意:

  • 该方法在macOS Sierra和Big Sur上已经验证可行。
  • 当只安装了CommandLineTools而没有安装Xcode时,使用xcodebuild会返回以下错误:

# /usr/bin/xcodebuild -version
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

谢谢!这个方法只适用于只安装了CommandLineTools而没有安装Xcode的情况,并且解决了运行/usr/bin/xcodebuild -version时出现的错误:xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

在Monterey(12.5)上,我得到了以下结果:No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.有什么想法吗?(我只安装了命令行工具,没有安装Xcode。)

谢谢。在Monterey(12.6.1)上也可以正常运行。

我在Monterey 12.6.2上遇到了相同的问题。

0
0 Comments

如何确定是否安装了Xcode命令行工具?

要获取Xcode版本,请在终端命令中运行以下命令:/usr/bin/xcodebuild -version

要仅获取版本,请使用以下命令:/usr/bin/xcodebuild -version | sed -En 's/Xcode[[:space:]]+([0-9\.]*)/\1/p'

我使用上述命令遇到了错误。错误信息是“-bash: /usr/build/xcodebuild: No such file or directory。”通过运行gcc --version命令,我确认我已经安装了Xcode,并获得了gcc的详细信息。我使用的是Mac OS X 10.13.6。

SRIVASTAVA: 正确的路径是"/usr/bin",而不是"/usr/build"。实际上,只需使用xcodebuild命令即可,因为"/usr/bin"通常在PATH中。

我得到了以下错误消息:“xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance”。我认为,在只安装了CommandLineTools而没有安装Xcode的情况下,请参考下面stackoverflow.com/a/42144725/311288的答案。

在Monterey zsh上,这将输出:“MacBook-Pro ~ % /usr/bin/xcodebuild -version xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance”。然而,我非常确定我已经安装了Xcode用于git...我现在不记得了。我只是想解决Symfony CLI的一个警告。

0