The chemical reactions and pathways resulting in the formation of pheromones, a substance that is secreted and released by an organism and detected by a second organism of the same or a closely related species, in which it causes a specific reaction, such as a definite behavioral reaction or a developmental process.