I don't think there is a really easy way to do this today, here are some details:
- clang comes installed on macOS and is the default compiler, but it does not come installed with clang-format or clang-tidy (or possibly any of the extra tools).
- It's really easy to use brew to install clang-format if you want it:
brew install clang-format
- There is no clang-tidy brew formula.
As a result it seems like the best way to get clang-tidy on macOS is to simply install all of llvm and then make symlinks for the tools you want to use.
brew install llvm
ln -s "$(brew --prefix llvm)/bin/clang-format" "/usr/local/bin/clang-format"
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy"
ln -s "$(brew --prefix llvm)/bin/clang-apply-replacements" "/usr/local/bin/clang-apply-replacements"
Alternatively, you could download the prebuilt binaries and create the same symlinks. It's not a good idea to add all of llvm to your PATH
because of conflicts with the default clang compiler.