A cellular process that results in the biosynthesis of constituent macromolecules, assembly, and arrangement of constituent parts of a type IV pilus. A type IV pilus is composed of a pilus fiber and approximately ten proteins at its base; type IV pili play a role in cell motility, adherence to substrates, and aggregation.