The characteristic smell of beer is very easy to recognize, and never fails to attract beer lovers. But now scientists have found that it’s really meant to attract something else entirely: fruit flies.

It turns out those pesky, impossible-to-catch little flies aren’t just an annoyance for brewers. Yeast and fruit flies have evolved a mutually beneficial relationship that hinges on that smell, according to new research.

Yeast produce small quantities of volatile compounds that give beer a pungent smell that’s somewhat like ripening fruit. Scientists have already pinned down a particular gene that’s responsible for most of these aromas —if they knock out the gene, species like S. cerevisiae (brewer's yeast) no longer release the fruity smells, and if they overactivate the gene, the yeast produce even more of the aroma.

While studying this years ago, bioengineer Kevin Verstrepen noticed that fruit flies in his lab swarmed around overactivated, flavorful yeast, and ignored non-fruity mutant yeast.

“I kind of knew already what the story would be then,” Verstrepen said.

In a new study published today in Cell Reports, Verstrepen and his team at University of Leuven and the Flanders Institute for Biotechnology in Belgium looked closer at how fruit flies react to the mutant beer yeast. They sent the flies into a cage and blew in air collected from different S. cerevisiae cultures. As expected, the fruit flies showed a strong preference for the smelliest yeast and didn’t pay any attention to the non-fruity yeast air. They also discovered that when the flies landed on fruity yeast, they unwittingly picked up the microbes on their legs and transported them to different sites around the cage.

Both species gain from this aromatic attraction, according to Verstrepen, and it’s a relationship that’s likely been around for millions of years. Fruit flies eat yeast like S. cerevisiae for protein, and the scents help lure them to the source. In exchange, yeast use fruit flies to hitch a ride and disperse to new habitats. “I think it’s the first description of this kind of smell-based collaboration,” Verstrepen said.

Because yeast can’t move around on their own, he says, they probably developed this strategy as a way to escape nutrient-poor environments and migrate to nutrient-rich places that fruit flies frequent, like ripe fruit or rotting trash.

“They definitely have good support for this mutualism,” said beer scientist Steve Wagner, who wasn’t involved in the study. “And I’d think this relationship pre-dates humans fermenting beverages, which only began about eight to ten thousand years ago.”

The aroma-based symbiosis may also apply to other microbes. “It’s possible that this type of relationship is actually really common,” said Verstrepen, “We think that some pathogenic microbes may even use this strategy with insects.”

Brewers ordinarily detest fruit flies because the insects can carry unwanted microbe species with them. For instance, fruit flies often hang out on rotten fruit where they collect acetic acid bacteria. They then transport those microbes to a batch of beer where the bacteria convert ethanol into vinegar, which ruins the alcohol.

But there’s a new trend among beer-makers called ‘wild fermentation’ that lets microbes spontaneously colonize the batch to achieve a more local flavor, and Verstrepen’s research helps explain how that happens. “You could catch a few flies in your vineyard, put it in your grape juice, and make a very unique wine,” said Verstrepen. He says he’s also considered using fruit flies, rather than machines, to select better yeast strains for brewers.

“But to be honest,” he said, “those are ideas I get after I’ve had a pint of beer on a Friday night.”