There's no hiding from a fruit fly infestation. When those tiny little bugs invade your kitchen and swarm around your fruit bowl or sink, you know it. Fortunately, the solution to this problem is fairly straightforward, and learning how to get rid of fruit flies and how to set a fruit fly trap is pretty easy. It does, however, help to understand where fruit flies come from first, so you have a better idea of how to kill fruit flies. (And if that sounds a little aggressive, I would bet that you're not the one panicking right now, trying to figure out a way to get these bugs out of your kitchen.) 

Fruit flies are called fruit flies because they're attracted to fruit, as well as other sweet, sugary substances, as a place to breed. Bananas are particularly enticing to fruit flies, but any soda or bottles of alcohol that you might have sitting out can also attract these bugs. And if you're dealing with a fruit fly infestation, that means the bugs have already started breeding in your home—and that means they've laid their eggs under the skin of the fruit and in the fermenting bottles of booze.

That's why the first thing you can do to get rid of fruit flies in your home is also the easiest. Get rid of your countertop fruit bowls and your open bottles of booze. If that sounds like a waste of good food, think of it this way. Consuming those sweet substances-slash-breeding grounds greatly increases your chance for accidentally consuming fruit fly larva. Feel better about throwing them out now?

Fruit and booze aren't the only places where fruit flies can breed, though. Another really common place for the flies to lay their eggs is in trash cans or garbage disposals or even sinks—anywhere that's kind of moist and regularly collects organic matter. That's why the experts at Real Simple recommend giving all of these surfaces a deep clean if you're dealing with a fruit fly infestation: "Frequently clean recycling bins that hold empty bottles and cans, and make sure the contents are thoroughly cleaned before discarding. Be sure the bottoms and the sides of garbage cans are free of any small bits of food or spilled juices."

Sadly, though, cleaning house isn't going to fix all of your problems. According to pest control company Orkin, fruit flies lay up to 500 eggs at a time with a life cycle of about 25 days, so even if you've gotten rid of all the potential breeding grounds you can think of, there may still be some residual fruit flies buzzing around. That's when you want to set a fruit fly trap, and there's a few ways you can go about doing that.

The idea behind a fruit fly trap, explains Faith Durand at The Kitchn, is to "attract the flies but make it tough for them to get back out." That's why the easiest at-home fruit fly trap is also the simplest. Simply fill a Mason jar or a glass with apple cider vinegar or a little bit of beer or some wine, and cover it with plastic wrap and secure with a rubber band. Poke a small hole, through which the fruit flies can enter, but make sure it's small enough that they can't come out. Then all you have to do is watch the bodies pile up, and feel confident that your fruit fly problem is settled.