Back to TILs

How to install clang 16 on debian

Date: 2022-12-13Last modified: 2023-02-17

Install key:

wget -O -|sudo apt-key add -

Create source list file:

cat <<EOF > /etc/apt/sources.list.d/llvm.list
deb llvm-toolchain-bullseye main
deb-src llvm-toolchain-bullseye main
# 14 
deb llvm-toolchain-bullseye-14 main
deb-src llvm-toolchain-bullseye-14 main
# 15 
deb llvm-toolchain-bullseye-15 main
deb-src llvm-toolchain-bullseye-15 main
# 16 
deb llvm-toolchain-bullseye-16 main
deb-src llvm-toolchain-bullseye-16 main

Update package list and install

apt update
apt-get install \
  clang-16 \
  clang-tools-16 \
  clang-16-doc \
  libclang-common-16-dev \
  libclang-16-dev \
  libclang1-16 \
  clang-format-16 \
  python3-clang-16 \
  clangd-16 \

To upgrade to the last version:

apt-get install clang lld