How to get rid of fruit flies — and stop them before they appear
The entire life cycle of a fruit fly is completed in a week or two, DeVries says, so “you don’t have to wait very long for the entire population to come crashing down.”
First thing’s first: There’s no need to pull out the insecticide, DeVries says. That’s something you want to avoid in the kitchen, where you are preparing food. It’s also totally unnecessary and won’t solve the problem in the long term. If you want to eliminate the bugs you see flying, DeVries recommends an old-fashioned fly swatter or a vacuum cleaner, which you can empty outside.
You can also trap them. Dellinger says there are commercial traps out there, but you can make one with materials you likely have on hand. Fill a small jar or container with half an inch of fruit juice, vinegar, apple cider or wine, and add a couple of drops of dishwashing detergent. Cover with plastic wrap and then punch a few holes in the wrap. The flies will be attracted by the bait, but won’t be able to escape because the soap breaks the surface tension of the water, trapping the flies. Another model involves a similar strategy of a bait and soap, but you construct it by cutting a bottle (soda, water, etc.) in half and then inverting the top half and setting it into the bottom to create a funnel, DeVries says.
But these steps only eliminate the adults. “If you don’t find the breeding source, you’re going to have the same problem in a few days,” DeVries says. So you need to find what’s attracting them and clean it up. And make sure you eat or refrigerate your ripe produce before it starts to go off.