Prevent fruit flies by thoroughly checking the produce you buy to make sure there are not cracks or nicks where fruit flies could be hiding. Wash and dry unrefrigerated produce as soon as you bring it home to remove any eggs on the surface. Fruit flies lay their eggs on anything sugary or fermented, so make sure you regularly clean up spills, take the garbage out, and clean your sink drain.