I want to use Emacs LSP c-mode, but I'm getting the error 'Command "clangd" is not present on the path'.
I did the following steps to install:
- Get lsp package from melpa-stable
- Get company-lsp from melpa-stable
- Get ccls using homebrew
Add the following to my .emacs file:
(require 'lsp-mode) (add-hook 'rust-mode-hook #'lsp) (add-hook 'c-mode-hook #'lsp) (require 'company-lsp) (push 'company-lsp company-backends)
I have installed llvm (which should include clang) using homebrew and added its path as an environment variable.
Does anybody know why I get this error?
I have just managed to set it up.
The problem is that on os x your environmental variables are not imported correctly when using GUI emacs. In particular, if you try evaluating in your emacs
you will get a different output from what you get by running
in your terminal.
I have solved this by installing exec-path-from-shell as suggested here.
Finally, double check (even though you've mentioned, you've done this) that not only have you installed llvm, but also correctly added it to your path, by running
as suggested here