Reputation: 415
I am trying to use clangd
with Spacemacs according to the c-cpp page. I have tried downloading the macOS binary for LLVM and I have followed this and this, but when I run which clangd
, it says it cannot be found. I have also run brew install llvm
, but that also doesn't show that clangd
is in my path. I do have a binary under /usr/local/Cellar/llvm/9.0.0_1/bin
, but my LSP doesn't do anything when I restart Emacs and open a C++ source file. I have /usr/local/bin
in my path.
Upvotes: 4
Views: 8682
Reputation: 415
I added /usr/local/opt/llvm/bin/
to my PATH and that worked. Thanks to Mikael Springer. I wonder why it wasn't working with the other location (and why I have multiple copies of llvm binaries).
Upvotes: 8
Reputation: 161
I have the following in my init.el with Emacs, not Spacemacs;
(use-package lsp-clients
:config
(setq lsp-clients-clangd-executable "/usr/local/opt/llvm/bin/clangd")
(setq lsp-clients-clangd-args '("-j=4" "-background-index" "-log=info" "-pretty" "-resource-dir=/Applications/Xcode9.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0")))
As you can see I use use-package
for Emacs package management but the important part is setting the lsp-clients-clangd-* variables. I install LLVM (and clangd) using brew install llvm
.
I don't know how or if this might help you since you use Spacemacs and I am not familiar with configuring Spacemacs.
Upvotes: 1