The ComX pheromone is an extracellular signaling molecule that stimulates natural competence in response to crowding in the gram-positive bacterium Bacillus subtilis. The pheromone is formed by isoprenylation of an inactive precursor peptide, but its precise structure is not known. Here we report the structure of the ComX pheromone, showing that addition of a geranyl group to a tryptophan residue results in the formation of an unusual ring structure.