How Do You Keep Carrot Fly Away Using Companion Plants?

Carrot fly (Psila rosae) is one of the most damaging carrot pests in temperate gardens. The fly lays its eggs at the base of carrot plants, and the hatching larvae burrow into the roots, creating rusty brown tunnels that make the carrots inedible. The fly is a low-level flier that navigates entirely by scent — it detects the volatile compounds released by carrot foliage. This navigation strategy makes companion planting one of the most genuinely useful tools for carrot fly management.

Why Scent-Based Companions Work Against Carrot Fly

Because carrot fly navigates by scent, any strongly aromatic plant that creates a competing smell cloud in the same area will reduce the fly's ability to locate carrots. This is the theory behind interplanting onions and carrots — when both crops are present, the onion scent partially masks the carrot scent. For this to work you need the aromatic companion to be as dense as the carrot planting — a single onion plant per metre will not create enough scent to matter. Alternating rows of the same density is the correct approach.

Onions and Leeks — the Primary Companions

Onions are the most effective scent-masking companion for carrot fly because their sulphur odour is strong and persistent throughout the season. Leeks work at least as well — they are in the same plant family, release similar compounds, and have the advantage of occupying a slightly different soil depth so root competition with carrots is minimal. Interplant carrots and leeks in alternating rows 20–30 cm apart, starting both from seed or transplant at the same time so neither gets ahead of the other.

Rosemary and Sage as Aromatic Barriers

Rosemary and sage planted as a low hedge around the outside of the carrot bed add another layer of aromatic confusion. Their woody, resinous scent is quite different from onion but adds to the overall sensory confusion that carrot fly encounters. Rosemary in particular is quite large and robust enough to serve as a windbreak around the carrot bed, which has the secondary benefit of reducing the physical drift of carrot scent downwind where it might attract flies from further away. Plant rosemary on the prevailing-wind side of the bed if possible.

Barriers Combined with Companions

Companion planting alone does not provide total carrot fly protection in high-pressure areas. The most reliable approach combines scent-masking companions with a physical barrier — a 60 cm tall fine mesh or fleece fence around the carrot bed that prevents the low-flying pest from reaching the plants. Because carrot fly rarely flies higher than 45–50 cm, even a moderate fence is very effective. Using both strategies together gives you near-complete protection without pesticides.

What to Avoid Near Carrots

Do not grow parsnips adjacent to your carrot bed — parsnips are equally attractive to carrot fly and putting both crops in the same area concentrates vulnerability rather than dispersing it. Coriander and other umbellifer relatives of carrots are similarly attractive to the fly. Keep the carrot bed away from areas where you are growing dill that has gone to seed, as it attracts the same pest family. Disturb carrot foliage as little as possible when weeding, as bruised leaves release a strong scent burst that attracts flies from a distance.

Keep Carrot Fly Out of Your Garden

Get the full companion planting and barrier strategy for carrot fly — including row spacing, barrier heights, and companion timing for your growing season.

Get the companion planting guide