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.
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.
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.