On my MacBook Pro I have Homebrew as well as the CUDA toolkit. OSX and Homebrew prefer the 'latest' version of clang (currently version 9.0.0). Clang is used for several Homebrew packages that I need. Without a recent version of clang, those packages won't compile (and brew won't update). But for nvcc, I am forced to use the older clang version 7.3.1. So I think I need two concurrent versions of clang.
I know that I can install a different version of clang by downloading and installing the version I need from the Apple Developers site, as explained here, but there must be an easier way to work with two concurrent versions of clang (using some script to switch from one version to another).
I also found that, aside from using Apple's own commandline tools, I could use the LLVM package from brew, with the
--with-clang option, as explained here.
So my question is: how to use and maintain two versions of clang?
PS: Just to show that I made the consideration: I know this question belongs somewhere in the grey area between Stack overflow and Ask Different. Please let me know by commenting if you think I am wrong to put it here; I'll move it to the other side if that seems to be the consensus.