M HYPE SPLASH
// general

vim-clang-format: clang-format is not found

By Emma Valentine

I installed clang-format on Ubuntu 18.04 LTS with sudo apt install clang-format and the installation was successful. I can execute clang-format-6.0 now, but when I use ClangFormat in vim, it tells me that "clang-format is not found". How can I fix the problem?

1 Answer

If you check what is contained in the package clang-format-6.0 (dpkg -L clang-format-6.0) you will find that it does not install clang-format into the /usr/bin directory. But you will find that it does install it to /usr/lib/llvm-6.0/bin instead.

One possible solution would be to add /usr/lib/llvm-6.0/bin to your PATH variable. Under this path clang-format is available. The command /usr/bin/clang-format-6.0 is just a symbolic link to it, so it should be equivalent to using clang-format-6.0. Why the package maintainer decided to not link /usr/bin/clang-format as well is not clear to me.

If you are unsure how to do that you may want to look it up here:

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy