How do you install clang-tidy on macOS?
It seems quite easy to install clang-format (using brew) on macOS, but it it seems much harder to install clang-tidy without install and building all of clang and building from source. Is there a better option?
I don't think there is a really easy way to do this today, here are some details:
brew install clang-format
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.