In Xcode app menu > Toolchains > set the one you want to use.
And set the environment variable export TOOLCHAINS=org.llvm.12.0.1. See the following steps to find the correct value of the env var.
If you just downloaded the compiler, headers etc., and no xctoolchain, then do this:
-
Copy
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchainto~/Library/Developer/Toolchains/ -
Delete the contents of
~/Library/Developer/Toolchains/XcodeDefault.xctoolchain/usr. -
Either copy the share, libexec, lib, include, bin folders from the LLVM binaries to these locations inside
~/Library/Developer/Toolchains/XcodeDefault.xctoolchain/usr. Or you can create symlinks. -
Edit the
~/Library/Developer/Toolchains/XcodeDefault.xctoolchain/ToolchainInfo.plistto change the Identifier to whatever you want.
Simply downloading the binaries doesn’t make it a “toolchain” that Xcode expects like in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain