Carrots and Rosemary
Beneficial Pair — Good Match
Rosemary's strong scent is real, but we're not aware of a study testing its effect on carrot rust fly specifically the way carrot-onion intercropping has been tested. This is inherited folklore built on a plausible-sounding but unconfirmed extension of the general 'strong smell deters pests' idea.
Mechanism: Pest Masking (Scent Confusion)
Rosemary's strong resinous scent is often credited with throwing off the rust fly that hunts carrots by smell, on the same general principle as onion's trial-backed sulfur-compound effect - though rosemary's aromatic oils belong to a completely different chemical family, so this rides on a broad 'strong smell confuses pests' assumption rather than an extension of the tested carrot-onion mechanism.
Rosemary shows up in companion-planting folklore as a general pest deterrent for all sorts of vegetables, carrots included, but it's worth being clear that this is a much less-tested claim than the sulfur-compound chemistry behind carrots and onions.
A Permanent Shrub Next to an Annual Root Crop
Beyond the unconfirmed scent claim, the more practical issue is scale and permanence: rosemary is a genuine woody shrub that keeps getting bigger year after year, while a carrot bed typically gets tilled, rotated, and replanted annually. The two aren't naturally compatible as an interplanted pair - rosemary belongs at a bed's permanent edge or in its own container, where its scent can still reach nearby carrots without the shrub itself being in the way of annual bed prep.
Spacing
Rosemary is a genuine permanent shrub needing 24-36 inches of its own space once mature - far more than carrots' 2-3 inch spacing - so this only works as a border planting at the edge of a carrot bed, never interplanted among the carrots themselves.
Watch For
Rosemary is slow-growing and, per this site's growing data, frost-tender in many climates, meaning it's often grown as a container plant or brought indoors over winter rather than left in the ground year-round - if that's your situation, this pairing is really about where you park the container relative to the carrot bed, not an in-ground planting decision.
Frequently Asked Questions
Can I plant rosemary directly in my carrot bed?
It's not a great idea - rosemary is a slow-growing, long-lived woody plant that doesn't fit well into a bed you're tilling and replanting every year. A border planting or a container kept near the carrot bed captures whatever scent benefit exists without that conflict.