Known as the smell of earth after rain, geosmin is an odorous terpene detectable by humans at picomolar concentrations. Geosmin production is heavily conserved in actinobacteria, myxobacteria, cyanobacteria, some fungi and red beets (Beta vulgaris L.), suggesting it strongly contributes to the fitness of these organisms. Prokaryotes produce geosmin through the terpene cyclase “geosmin synthase” converting germacradienol into geosmin via isoprenoid pathways (methylerythritol phosphate, mevalonate or leucine-dependent). However, the universality and ecological role of geosmin is poorly understood. I theorized that geosmin is an aposematic signal used to indicate the unpalatability of toxin-producing microbes, discouraging predation by eukaryotes. Consistent with this hypothesis I have found that geosmin reduces predation of Streptomyces coelicolor and Myxococcus xanthus by the bacteriophagous Caenorhabditis elegans. Predation was restored by the removal of both terpene biosynthetic pathways or deletion of the C. elegans ASE sensory neuron and resulted in the death of the nematodes. Geosmin itself was non-toxic. This is the first warning chemical to be identified in bacteria or fungi, and suggests molecular signalling affects microbial predator-prey interactions in a manner similar to the well-studied visual markers displayed by poisonous animal prey. In line with geosmin being a warning chemical, I also determined from a bioinformatics analysis that geosmin synthase was acquired from a distant past through horizontal gene transfer with Actinobacteria as the ancestral genetic reservoir. In addition, my work also suggests that several genes not directly involved in the biosynthesis of geosmin nevertheless support its activity. The investigation of these genes may enhance our understanding of the biosynthesis and regulation of geosmin and terpenes in prokaryotes.