Meanwhile LLVM has released apt packages for LLVM 13 and 14 but out-of-the box clang-format-13, clang-tidy-13, ... are not available via apt-get install clang-format-13
.
How can I install clang-format-13 on Ubuntu 18.04?
Meanwhile LLVM has released apt packages for LLVM 13 and 14 but out-of-the box clang-format-13, clang-tidy-13, ... are not available via apt-get install clang-format-13
.
How can I install clang-format-13 on Ubuntu 18.04?
First of all do a sudo apt update
and an optional sudo apt upgrade
and check everything is fine and works.
Second backup the sources.list you want to update (next).
Add the matching repository from https://apt.llvm.org/ to one of your sources, e.g. /etc/apt/sources.list
. Example:
sudo add-apt-repository 'deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main'
That should add the following to the end of your /etc/apt/sources.list
:
deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main
# deb-src http://apt.llvm.org/bionic/ llvm-toolchain-bionic-13 main
Then execute sudo apt update
. In case you get an error stating 'The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ...' then you have to add the missing public key with apt-key add
:
# download key file
wget https://apt.llvm.org/llvm-snapshot.gpg.key
# add the key
sudo apt-key add llvm-snapshot.gpg.key
One liner: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
. Please notice that you now trust the packages with that key!
Then you can install clang-format-13, clang-tidy-13 on Ubuntu 18.04:
sudo apt update
sudo apt install clang-format-13
This should also work for Ubuntu 20.04 (http://apt.llvm.org/focal/
and llvm-toolchain-focal-13
) or clang-format-14.