Fruit flies are a common household nuisance during the summer and fall harvest season. Ripe fruit, organic garbage and soda cans attract the flies. They are also fly around household plants, attracted by organic fertiliser in the potting mix. If your aloe plants have any rotted leaves -- caused by overwatering -- they may be particularly attractive to fruit flies.
Cut off any wilted, rotted or diseased leaves from the aloe plant with sharp scissors and dispose of them.
Replace the plant's potting mix with a sterilised or pasteurised potting mix. Do not add any fertiliser or compost to the soil.
Eliminate fruit fly attractions in the home. Take out trash often, and rinse out soda and beer cans and bottles before placing them in the recycling bin. Place ripe fruit in the refrigerator where flies don't have access. If you have a garbage disposal, fill up the sink with hot, soapy water and run the disposal to eliminate excess waste and odours.
Hang non-toxic sticky flytraps around the aloe plant and anywhere else where fruit flies are a problem.
Make a fruit fly trap and set it next to the aloe plant: pour beer in a glass jar to a depth of 1 inch. Stretch a small plastic sandwich bag over the jar's opening so that a corner of the bag falls into the jar like a funnel. Poke a hole in this corner and attach the bag in place with a rubber band. The smell of beer will attract flies, and they will enter the jar through the hole. Unable to escape, they will drown in the beer.
Spray remaining flies in flight with pyrethrin-based bug spray. Avoid spraying the aloe leaves directly, as this could injure the plant.