如何找到Mac上安装的所有Clang版本? [英] How can I find all Clang versions installed on my Mac?
问题描述
clang --version
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
which clang
/usr/bin/clang
我在Mac上的10.13.6版,任何说明都将不胜感激!
I'm on Mac, 10.13.6, any instructions would be appreciated!
推荐答案
您可以使用 which -a clang
列出所有 clang
在您的路径
上。不在您的 PATH
上的内容(例如,如果您在不寻常的地方安装了Clang)将不会显示。
You can use which -a clang
to list all of the clang
s on your PATH
. Ones which aren't on your PATH
, like if you've installed Clang somewhere out of the ordinary, won't be shown.
一个复杂的问题是 / usr / bin / clang
实际上是一个蹦床,会启动 clang
在当前活动的开发人员目录中,由 xcode-select
或 DEVELOPER_DIR
环境变量选择。因此,知道 / usr / bin / clang
在那儿并不会告诉您它将反弹到哪个版本或可以激活哪个其他版本。 xcrun -f clang
会告诉第一个(将被反弹到)。据我所知,没有办法让Apple的工具列出可能的开发人员目录。因此,如果您安装了多个版本的Xcode(或命令行工具),则其中-a clang
将看不到它们。
A complication is that /usr/bin/clang
is actually a trampoline that launches the clang
within the currently active developer dir, selected by xcode-select
or the DEVELOPER_DIR
environment variable. So, knowing that /usr/bin/clang
is there doesn't tell you either which one it will bounce to or which other versions could be activated. xcrun -f clang
will tell the first (which will be bounced to). To my knowledge, there's no way to get Apple's tools to list out the possible developer dirs. So, if you have multiple versions of Xcode (or the Command Line Tools) installed, which -a clang
won't see them.
一种更可靠的方法是搜索文件系统。您可以使用 find / -type f -perm + a + x -name clang
,但这会很慢。您可以尝试的另一件事是Spotlight,但我发现Xcode应用程序捆绑包的内部没有建立索引。
A more reliable way would be to search the file system. You could use find / -type f -perm +a+x -name clang
, but that will be slow. The other thing you can try is Spotlight, but I find that the internals of Xcode app bundles are not indexed.
这篇关于如何找到Mac上安装的所有Clang版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!