I tried searching with pacman -Ss for clang-format, git-clang-format, etc, but I'm not having any luck.

However, I have seen some references to it on some other websites, implying it may exist (or have existed) somewhere.


It turns out that MSYS2 already comes with clang installed, and clang comes with clang-format. As of my version of clang, I have clang-format 9.0.0 installed. it's possible much earlier versions of clang did not come with it installed.


As utilities, clang-format and git-clang-format are available in several forms:

  • As a part of clang.

    [As noted by OP in the final comments below, and with OP's answer to their own question, these should be included with MSYS2/MingGW on Windows].

  • As pre-compiled Python wheels for Linux (only) available via pip (PyPI).

  • As modules available for Node.js. On Windows, use the standard Windows installer to install Node.js. Otherwise, example Linux package manager commands for installing Node.js are here.


For Python versions on Linux, you may wish to try:

python3 -m pip install clang-format 


Assuming Node.js is installed, you can also get them both with:

npm install -g clang-format

Note that on Windows, using the Node.js option seems to be the simplest solution for obtaining just clang-format and git-clang-format (without installing MinGW).

  • The nodejs modules are just wrappers around the real clang-format, from what I can tell on that page. Doesn't that mean the normal clang-format executable still has to be installed somewhere, or did I misunderstand? Nov 26 '19 at 16:52
  • Is npm available on mingw/mingw64? I attempted Pacman -Ss npm and as well for "node", but got no results related to node-js. Nov 26 '19 at 17:08
  • No luck with nodejs either. Wondering if it's possible to build clang-format from source. clang, clang-analyzer, clang-tools-extra, compiler-rt, libblocksruntime (all version 9) are all available on mingw. Apparently clang itself isn't enough to run the compiler though. Nov 26 '19 at 17:18
  • I saw that you updated your post. With Python3, I get: ERROR: Could not find a version that satisfies the requirement clang-format (from versions: none) ERROR: No matching distribution found for clang-format. For nodejs, I cannot find how to install it on mingw. Nov 26 '19 at 18:02
  • Both of those alternative commands failed with the same error. No idea what you mean by "specialized". Nov 26 '19 at 18:18

You can get it as part of the LLVM compiler build for Windows. You can download it from https://llvm.org/builds/. Once installed, clang-format.exe can be found in C:\Program Files\LLVM\bin.

I know it's a bit heavy to install the whole compiler just to get the formatter, but yeah, it just feels safer compared to other sources, given that it's from LLVM itself.

  • One can directly download clang-format.exe and add it to PATH without installing LLVM. It is available at the bottom of the page builds.
    – Burak
    May 11 at 21:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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