As female carrot flies are very low flying, the best method of prevention is to erect a barrier around the crop at least 2 feet (60 cm) high. Alternatively horticultural fleece may be used as a floating mulch to cover the crop. Because the carrot fly is attracted to host plants by odor, masking the smell of the host plant by planting odoriferous companion crops such as onions, chives, and garlic can successfully deter attack.
Since female carrot flies are very low flying, the most effective way to prevent them is to set up a barrier around the crop at least 2 feet (60 cm) high. Another approach is to use horticultural fleece as a floating mulch to cover the crop. By using scent-masking companion crops like onions and garlic, the carrot fly's attraction can be successfully deterred.