cc is not installed in the base OS. How do I install it?
You build a new FreeNAS/TrueNAS image that includes it. Because the C compiler normally comes as part of the base FreeBSD system, but is omitted in the FreeNAS/TrueNAS appliance build, there isn't anything that automatically installs it for you. Such abuse was never envisioned and no one wrote a tool to do it, because you're not supposed to do it.
Please do not make editorial comments on why I want to do this or that this is not a development platform or only an idiot would do this.
<moderator hat on>
Please ditch the attitude.
</moderator>
These are not "editorial comments." They are a statement of fact. All sorts of tools that might exist on a development platform are not present on the base appliance. This includes stuff such as all the critical bits in /usr/include, the system linker (ld), the compiler (clang), etc. We are not withholding some secret command like "pkg add system-includes clang ld" from you.
FreeNAS was originally a stripped NanoBSD but eventually became a stripped down FreeBSD version. Since the compiler takes up a lot of space, and since it would encourage user misbehaviour while serving no legitimate purpose, it has historically been omitted from the build.
What I want to do it recompile the kernel to update the driver for my SCSI controller without having to build a full FreeBSD virtual machine.
Unfortunately, if this is a rehash of your previous attempts to "rebuild the kernel" to "install a driver" for ancient parallel SCSI cards, I will note once again that the
Dell PERC 4e controller is supported by the amr driver, which isn't included with FreeNAS/TrueNAS, but could possibly be bapped over from a generic FreeBSD install.
Now, you've already been given several different paths to solve your problem. Most recently, just a few days ago, I advised you that you
could build a TrueNAS release containing whatever you liked.
This is at least the third iteration on this theme, and as a moderator, I am asking you to cease and desist posting variations on the same "how do I compile in the base OS" issue in different ways and different subforums. You are absolutely welcome to post questions resulting from efforts to follow any of the guidance people have offered you.