Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I install CLang on Ubuntu, using precompiled binaries of CLang that I downloaded?

Here's how I downloaded CLang: "LLVM Download Page" -> "Download LLVM 3.2" -> "Clang Binaries for Ubuntu-12.04/x86_64" ( .)

Then, I expanded the archive into a folder on my Ubuntu 12.04 LTS 64-bit machine. The contents of the expanded folder look like this:

$ ls clang+llvm-3.2-x86_64-linux-ubuntu-12.04
bin  docs  include  lib  share

Question: What do I do next? Do I have to copy these into some folders myself, and if so, which ones exactly? Most instructions I found online are for building CLang from source, which doesn't apply here.

I am a newbie to most of these tools. I created a basic hello-world C++ program, and was able to compile and run it, using GCC and autotools. Now, I want to compile the same program with CLang.


Also asked on StackOverflow: How to install CLang using precompiled binaries?: .

Possible duplicate: How do I install LLVM/Clang 3.0? (However, that answer does not have the specific steps needed.)

share|improve this question
My answer gives the installation instructions, if you are interested I can add removal instructions as well? – andrew.46 Jun 11 at 23:55

Perhaps the easiest way to install this archive is to use the following 2 commands:

sudo tar -C /usr/local -xvf clang+llvm-3.2-x86_64-linux-ubuntu-12.04.tar.gz --strip 1

This works nicely on my 12.04 VM and gives the following:

andrew@ithaca:~$ clang --version
clang version 3.2 (tags/RELEASE_32/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

This installation takes away the ability to easily remove the package with standard Ubuntu package management tools but the following single command will remove all of the installed files:

sudo rm -v /usr/local/bin/{clang*,llc,lli,llvm*,macho-dump,opt,bugpoint,c-index-test} && \
sudo rm -rfv /usr/local/docs/llvm && \
sudo rm -rfv /usr/local/include/{clang,clang-c,llvm,llvm-c} && \
sudo rm -v /usr/local/share/man/man1/clang.1 && \
sudo rm -rfv /usr/local/lib/clang && \
sudo rm -v /usr/local/lib/{,libclang*,libLLVM*,libLTO*,libprofile_rt*,LLVM*}

Tested on my own system and it removes the files cleanly...

share|improve this answer
And how do you remove it then? – Somebody Jun 12 at 5:59
I have added in the removal instructions which work nicely on my own Precise installation. – andrew.46 Jun 12 at 10:09

There are now pre-compiled binaries of Clang 3.3 for Ubuntu 12.04 here:

share|improve this answer
The question is about how exactly to install the binaries. – user1909987 Jun 22 '13 at 12:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.