Locate and remove their breeding grounds. The breeding sites have to be removed before you can kill all the fruit flies in your home.
Take the garbage outside and try to store the fruit in the refrigerator.
Find one or several pint jars. The number of fruit jars needed depends on the number of rooms where the fruit flies are and the number of fruit flies.
Fill a pint fruit jar with cider vinegar. There should be at least 1/2 inch to 1 inch of vinegar at the bottom.
If you don't have cider vinegar, you can use a piece of banana.
Make a funnel out of a sheet of paper. The bottom should have a narrow opening that measures about 1/4 inch in diameter.
Tape or staple the funnel so it keeps its shape, and then place the narrow end of the funnel into the far first. Fashion it wide enough at the top to keep the end of the funnel from touching the vinegar in the jar.
Place the jar or jars with vinegar in the area where fruit flies are prominent. The fruit flies will fly down through the tunnel to get to the cider vinegar.
Once they are there, they become trapped and many of them will drown.
Check the jars once a day. Take the jars outside when you have caught the fruit flies and release them.
Take them far enough away from the doors and windows of your home so they cannot fly back inside when you release them.