Search code examples
freebsdclang-format

Cannot find clang-format in FreeBSD 11.2


I installed a FreeBSD virtual machine and then I ran sudo pkg install clang-devel.

clang-format seems to be missing however:

-sh: clang-format: not found

How to install clang-format in FreeBSD 11.2?


Solution

  • You may look at the files installed by the clang-devel package (for example on FreshPorts).

    I can see a couple of files which might be the one you are looking for:

    • bin/clang-format-devel
    • llvm-devel/bin/clang-format

    They are installed under /usr/local by default.

    Alternatively, you may use the advanced search feature on FreshPorts. Here's the link to the search result for clang-format in pkg-plists (pkg-plist is a file with a list of files installed by a package): https://www.freshports.org/search.php?stype=pkg-plist&method=match&query=clang-format&num=100&orderby=category&orderbyupdown=asc&search=Search&format=html&branch=head

    It's worth noting that there is no easy way to do it with pkg(8) or ports(7) as some packages generate their pkg-plists dynamically. This is why the easiest solution is to use external services like FreshPorts. There is also a plugin for pkg(8) called pkg-provides available in the FreeBSD ports tree, which might be what you are looking for. I've never tried it, however.