As of now you can just do
brew install llvm
For me this installed llvm and clang 4.0.0 to /usr/local/opt/llvm
macos - How to install 'clang++' on OS X - Stack Overflow
development - How to install recent clang++ with Homebrew? - Ask Different
c++ - How can I download and install a particular version of Clang on OS X? - Stack Overflow
How to install clang 18(iMac M3)
Videos
As of now you can just do
brew install llvm
For me this installed llvm and clang 4.0.0 to /usr/local/opt/llvm
I suspect all you were missing was libstdc++ but trying to figure that out without seeing your build log is impossible. Especially as you say 'after installation...' when there's no installation step in the instructions you link to, only build?
So, I'm going to suggest you use brew to do the install along with the dependencies. llvm35 is a bit bleeding edge but the current instructions that install that with brew are:
Step 1: make sure you have a recent enough gcc/libc to build clang (may not be necessary for you):
$ brew install gcc47
Step 2: install the HEAD version of llvm35 with all the trimmings (see https://github.com/Homebrew/homebrew-versions/issues/340 - you MUST read this, because we are building HEAD versions the instructions might be updated tomorrow. Correct just now, I just built it!):
$ brew install isl --HEAD
$ brew install --cc=gcc-4.7 --HEAD llvm35 --with-asan --with-clang --with-libcxx --rtti --all-targets
# wait....
๐บ /usr/local/Cellar/llvm35/HEAD: 1427 files, 240M, built in 18.3 minutes
$ /usr/local/Cellar/llvm35/HEAD/bin/clang++-3.5 -v
clang version 3.5
Target: x86_64-apple-darwin12.5.0
Thread model: posix
Note my command differs from the one in the link by including --cc=gcc-4.7 to use the gcc installed in step 1; if your gcc is already good enough, you won't need that. This is installed keg-only so won't be in the usual paths (see: https://github.com/Homebrew/homebrew/wiki/FAQ, by 'Cellar' they mean /usr/local/Cellar; I've shown the path mine built above)
Now it's enough to run:
brew install llvm
The bottle now includes clang by default.
As of 2018, the Homebrew Versions repository ('tap') is out of service.
The stock Homebrew llvm package still doesn't include clang/clang++, by default. Thus, it isn't part of the prebuilt ('bottled') package.
One can build it via:
brew install --with-toolchain llvm
And then use it via e.g.:
$ PATH="/usr/local/opt/llvm/bin:$PATH" \
LDFLAGS='-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib' \
cmake ...
But this --with-toolchain induced build takes a very long time and is thus unsuitable in a continuous integration (CI) environment.
However, the clang that comes with recent XCode (which is available in CI environments like Travis-CI, Version 9 is the default, 10 available, too) isn't that outdated anymore as it used to be (Apple uses an fantasy version scheme for clang that doesn't match upstream clang version numbers but cmake detects e.g. for AppleClang 9.1.0.9020039 the version 4.0.1). Thus, it is sufficient to build C++11/C++14 software with common dependencies like Boost (e.g. version 1.67).
2016 State of the Art
The llvm package in Homebrew doesn't include clang++, by default. When installing it, you have to add --with-clang to the command line (e.g. brew install --with-clang llvm). The extra --with-clang yields a full package compile because there is only one prebuild ('bottled') llvm package available (without clang++). In addition to that: the llvm package is relatively old - currently it has llvm 3.6 - where 3.7 was released 6 months ago.
Thus, to get a bottled clang++ 3.7 you have to install the llvm package from Homebrew Versions:
$ brew tap homebrew/versions
$ brew install llvm37
It is then available under:
/usr/local/bin/clang++-3.7
The formula also notes:
To link to libc++, something like the following is required:
CXX="clang++-3.7 -stdlib=libc++"
CXXFLAGS="$CXXFLAGS -nostdinc++ -I/usr/local/opt/llvm37/lib/llvm-3.7/include/c++/v1"
LDFLAGS="$LDFLAGS -L/usr/local/opt/llvm37/lib/llvm-3.7/lib"
I have tried to install clang 18 but Xcode is forcing me to use clang 15 and I canโt delete Xcode bc it wonโt let me run vscode otherwise. Is there a way to do this.