Polyynes (polyacetylenes), which are produced by a variety of organisms, play important roles in ecology. Whereas alkyne biosynthesis in plants, fungi, and insects has been studied, the biogenetic origin of highly unstable bacterial polyynes has remained a riddle. Transposon mutagenesis and genome sequencing unveiled the caryoynencin (cay) biosynthesis gene cluster in the plant pathogen B. caryophylli, and homologous gene clusters were found in various other bacteria by comparative genomics. Gene inactivation and phylogenetic analyses revealed that novel desaturase/acetylenase genes mediate bacterial polyyne assembly. A cytochrome P450 monooxygenase is involved in the formation of the allylic alcohol moiety, as evidenced by analysis of a fragile intermediate, which was stabilized by an in situ click reaction. This work not only grants first insight into bacterial polyyne biosynthesis but also demonstrates that the click reaction can be employed to trap fragile polyynes from crude mixtures.