How to Install Binary Clang on Any GNU/Linux Distro

For clang, clang++ and several others including LLVM.

How to Install Binary Clang on Any GNU/Linux Distro

Clang is a front-end compiler for the languages C, C++ , Objective-C and Objective-C++ that uses LLVM as a backend .

It aims to be another alternative to GCC, the GNU set of compilers .


Download the latest version here, the package name should be: clang+llvm-<VERSION>-x86_64-linux-gnu-ubuntu- 18.04.tar.xz (despite having the name ubuntu and an old version, it works for any distro), according to the publication date of this article, the most recent version is 15.0.6, example:

The package has several binaries, including clang and clang++



tar xJf clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz

Move to /opt renaming to directory with shorter name, example: clang

sudo mv clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04/ /opt/clang

Export to your $PATH

echo 'export PATH="${PATH}:/opt/clang/bin"' | sudo tee -a /etc/profile
source /etc/profile


vim main.cpp

#include <iostream>

int main( int argc , char **argv ){
   std::cout << "Hello, World!\n";
   return 0;


clang++ main.cpp

Enjoy and count this new installation to your GNU Glibc by doing the following:

  • 01. Create a file named libs.conf and enter the lib path to it:

    vim libs.conf

And paste the path below into that file:

  • 02. Save and move to the new libs directory:
sudo mv libs.conf /etc/
  • 03. Read everything:
sudo ldconfig

And be happy! 😃

Mainly you who use Gentoo and NO will need to compile Clang every time there is a new version!!! It takes time pakas! 😛

llvm clang cpp clanguage