You might not love this answer—but getting rid of them is easy.
Fruit fly moms lay their eggs on everything, from just-starting-to-ripen fruit—like the kind you recently brought home from the market—to the small bits of old produce rotting in your kitchen garbage can, according to the University of Michigan. Even some vegetables, particularly old potatoes and onions, foster fruit flies.
That’s gross. Fortunately, if your fruit isn’t overripe or rotting, the fruit fly larvae and their proud parents haven’t yet burrowed their way deep inside your apples or pears, explains Dr. Gregory Courtney, an entomologist at Iowa State University. They’re just hanging out around the surface of your produce, waiting for the juices inside to start fermenting. (If the risk of pesticides or dirt never inspired you to wash your fruit, maybe the possible presence of fruit fly eggs will do the trick: washing produce rinses away the eggs before they’ve hatched, as long as the fruit is ripe and fresh.)
When the eggs hatch, the babies tunnel into your old bananas and tomatoes and lap up the bacteria and yeast they need to grow big and strong—and to produce hundreds more like themselves. Adult fruit flies likewise feed on the byproducts of the fermentation process, which are also found in wine, soda and everything else you’ve noticed the little buggers hovering around.
In cozy indoor temperatures, the whole birth to reproduction cycle lasts only a couple of weeks, Courtney says.
These insects tend to show up in large numbers in late summer and early fall because it’s the harvest season, and America is filled with the fruits of the earth. With those fruits come fruit flies. And that’s a good thing, Courtney stresses. “They’re not disease spreading, they’re just annoying,” he says. Also, they’re one of many insects that feed on decomposing food. We’d all be neck deep in rotting banana peels and apple cores without them.
But even if you appreciate the bugs’ utility around the compost or trash heap, you probably don’t want them buzzing through your kitchen or lounging on the rim of your wine glass. To get rid of them, Courtney says the best defense is the most obvious: banish all but the freshest produce from your countertops. “Bananas seem to be a big culprit, but that may just be because there are always bananas in my house,” he says.
Buy produce only as you need it, and keep ripe or overripe fruits and vegetables in your refrigerator. Make sure there are no old food scraps hanging out on your floors, countertops or trash. Keep your kitchen free of all those sources for a few weeks, and you’ll wipe out your local fruit fly population, Courtney says.
If a few weeks seems like too long to wait, the University of Nebraska—Lincoln offers a more aggressive solution: Fill a jar with an inch or two of warm water, a teaspoon of yeast and a small amount of sugar to activate the yeast. Take a plastic sandwich baggie, poke a small hole in one corner of it using a sharpened pencil and stick that corner inside the top of the jar. Now secure the bag around the rim of the jar with a rubber band.
The yeasty water will attract fruit flies, which will creep down the bag and through the hole but won’t be able to get back out. Clean out the jar and start over once a week until the fruit flies are gone. Just don’t dump the jar’s old contents in the garbage. The water will likely harbor many fruit fly eggs, so it’s best to dump it away from your house. If you toss it down the sink, run your faucet for a full minute to ensure the eggs are washed away, the UNL report advises.
Or you could just live with your fruit fly friends. They’re pesky, but they serve a purpose.