I have used brew install llvm
, so older answers (and the clangd website) say that clangd should already be installed.
But in the current version this seems to not be the case. clangd is not in my path and none of the folders I looked into have that binary.
I found these answers (none of them work):
Put
/usr/local/opt/llvm/bin/
in your path. I assume installing llvm should have created that directory, but it does not exist. (Link to Stack Overflow question)Find clangd in other folders (run
find /usr/local/ -name 'clangd'
). This doesn't have any results (Link to superuser question)Use the
--with-toolchain
flag for Homebrew while installing llvm.Error: invalid option: --with-toolchain
(Link to apple Stack Exchange question dealing with clang++)
Use the
--with-clang
flag for Homebrew while installing llvmError: invalid option: --with-clang
So my questions are:
- As of August 2021, how do I install clangd on a MacBook?
- Do I really have to manually build everything from sources?
Further information:
This is a MacBook (M1)
I found a clangd executable at
/opt//homebrew/Cellar/llvm/12.0.1/bin/clangd
Running
brew info llvm
results in a message containingIf you need to have llvm first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc
In that folder I found a clangd executable too, so I guess I should add this to my path instead of /usr/local/opt/llvm/bin
?