FreeBSD 10 was the first release that officially released with Clang as the default, base compiler.

Most ports, unless specially marked, now compile using the base ("pre-installed") clang.

However, clang development is moderately rapid, and so the version of clang in base can be out of date frequently - not only do we have to wait for clang to be imported into base, but then we have to recompile from base (make world) to install it; the other alternative for the more enterprising operator would be to navigate the source tree and attempt to rebuild and reinstall just clang.

It would be a lot easier to just use the version of clang that's in ports under lang/clangXX. Installing that's easy enough, but then how does one modify the ports infrastructure to use that install of clang instead of the base install of clang?

1 Answer 1


You would treat the ports clang as an alternative compiler, just like when GCC was the default.

As per the FreeBSD wiki, add the following lines to /etc/make.conf (if you want to use clang for everything, even ports), or /etc/src.conf (if you want to use clang just for world and kernel):


Check where the ports clang binaries where installed under /usr/local and adjust accordingly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .