Install clang-format, clang-tidy and other LLVM tools without building LLVM, as static binaries
or Python wheels, using the clang-tools CLI.
Website · Documentation · Get started · Discussions
pip install clang-tools
clang-tools install clang-format clang-tidy --version 21This installs the LLVM 21 static binaries clang-format-21 and clang-tidy-21. Without
--directory, they go to ~/.local/bin on Linux, and on macOS and Windows to the folder that
holds the Python executable (the bin or Scripts folder of a virtual environment).
Tip
It is recommended to use this package in a virtual environment.
python -m venv env-name
source env-name/bin/activate # Linux and macOS
./env-name/Scripts/activate # Windowsclang-tools install with --version installs the static binary and falls back to the wheel if
that fails; without --version, it installs the latest wheel. For a full list of CLI options, see
the CLI reference.
# Install a specific version (binary first, falls back to the wheel)
clang-tools install clang-format --version 21
# Install to a specified directory
clang-tools install clang-format --version 21 --directory .If the installed directory is in your path:
clang-format-21 --version
# clang-format version 21.1.0To uninstall, give the tool names and the version:
clang-tools uninstall clang-format --version 21 --directory .- Uses SHA512 checksums to verify downloaded binaries.
- Creates unversioned symlinks (e.g.,
clang-format) alongside versioned binaries (clang-format-21) for convenience. - If the versioned binary (e.g.,
clang-format-21) is already on your PATH, links to it instead of downloading.
Note
To create symbolic links on Windows, you must enable Developer Mode.
Important
This package only manages binary executables (& corresponding symbolic links) that are installed using this package's executable script. It does not intend to change or modify any binary executable installed from other sources (like LLVM releases).
Without --version, the latest wheel is installed from PyPI:
# Install the latest clang-format wheel
clang-tools install clang-format
# Install the latest clang-tidy wheel
clang-tools install clang-tidyWheels are installed with pip into the Python environment that runs clang-tools, so that
environment needs pip. --directory does not apply to wheels, and clang-tools uninstall does not
remove them; use pip uninstall <tool>.
Note
Wheel installation resolves the latest matching version from PyPI
(e.g. --version 18 finds 18.1.8). If you know the exact version,
pip install <tool>==<version> is equivalent and more direct.
pip install git+https://github.com/cpp-linter/clang-tools-pip.git@mainLLVM 12 to 23, for Linux, macOS and Windows on x86-64 and ARM64:
- clang-format
- clang-tidy
- clang-query
- clang-apply-replacements
- clang-include-cleaner (LLVM 18 and later)
- llvm-cov
- llvm-profdata
- llvm-symbolizer
- clang-scan-deps
For more details, visit clang-tools-static-binaries.
- clang-format
- clang-tidy
- clang-include-cleaner (LLVM 22)
- clang-apply-replacements (LLVM 16 and 17)
Only these four tools have wheels, so the other tools need --version. Check the respective PyPI
pages for available versions and platform support.
See the contributing guide and open an issue for bugs and feature requests.
This project is licensed under the MIT License.