How To Install Clang On Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora And Raspbian?

How To Install Clang On Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora And Raspbian?

clang

Compiler for C, C++, and Objective-C source files. Can be used as a drop-in replacement for GCC.

Maintainer: LLVM Packaging Team


Section: devel

Install clang

  • Debian apt-get install clang Click to copy
  • Ubuntu apt-get install clang Click to copy
  • Alpine OS apk add clang Click to copy
  • Arch Linux pacman -S clang Click to copy
  • Kali Linux apt-get install clang Click to copy
  • CentOS yum install clang Click to copy
  • Fedora dnf install clang Click to copy
  • Raspbian apt-get install clang Click to copy

Compiler for C, C++, and Objective-C source files. Can be used as a drop-in replacement for GCC.

How to use clang?

Below are few example commands for clang that you can use in the terminal.

Compile a source code file into an executable binary:
clang input_source.c -o output_executableClick to copy
Activate output of all errors and warnings:
clang input_source.c -Wall -o output_executableClick to copy
Include libraries located at a different path than the source file:
clang input_source.c -o output_executable -Iheader_path -Llibrary_path -llibrary_nameClick to copy
Compile source code into LLVM Intermediate Representation (IR):
clang -S -emit-llvm file.c -o file.llClick to copy
Installing clang command is simple. just copy one of the above commands for your operating system and paste it into terminal. This command is available for Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora and Raspbian operating systems. Once you run the command it will install the latest version of clang 2026 package in your OS.