Pest
Apple maggot fly
Rhagoletis pomonella
Also called Railroad worm
A network of brown winding trails through the flesh of a picked apple, made by a fly that switched from wild hawthorn to orchard apple within living memory of European settlement. A pest confined to North America, distinct from codling moth despite sharing a common name in casual use, and one of the clearest examples of a species evolving a new habit in real time.

At a glance
- Type
- Pest
- Cause
- Insect
- Severity
- Destroys the crop or display
- Affects
- Herbs and edibles
- Active
- July to October
- Established in
- North America
What you are seeing
- Small dimples on the fruit surface, visible as slight indentations rather than a hole, where an egg has been laid just under the skin
- Fruit rotting from the inside while the surface still looks close to sound, developing brown, winding, thread-like trails through the flesh as larvae tunnel
- Premature fruit drop well ahead of normal ripening
- Flesh that has turned to a brown, mushy, unpleasant-tasting mass by the time the trails are extensive, even where the skin shows little external damage
- A small fly about 5 mm long, black with white markings and banded dark wings held out to the sides, seen resting on fruit or foliage in summer
- Wild hawthorn nearby carrying similar internal damage, often the source of a new orchard infestation
Before you treat anything
Fruit with extensive internal trails is unpleasant rather than dangerous; cut it open before eating and discard anything badly affected.
What you are looking at
An apple that looks close to sound from the outside, marked with only a faint dimple or two on the skin where an egg was laid just beneath it, and that turns out to be rotting from the inside when cut open. Brown, winding, thread-like trails run through the flesh, and by the time they are extensive the interior has turned to an unpleasant brown mush even where the surface still looks presentable. Affected fruit often drops well before normal ripening.
The fly itself is small, about 5 mm long, black with clean white markings and dark banded patterns on wings held out to the sides at rest. It is often seen sitting on fruit or nearby foliage through mid to late summer rather than actively flying.
Not the same insect as codling moth
Casual conversation sometimes uses “apple maggot” as a loose stand-in for whatever grub or maggot happens to be in an apple, and that habit obscures a real and useful distinction. Codling moth, the insect responsible for most maggoty apples in Europe and much of the rest of the world, is a moth whose caterpillar bores a single neat hole straight to the core. This species is an entirely different, unrelated insect, a fly whose larvae tunnel throughout the flesh from just beneath the skin rather than driving for the core, and it is confined to North America. Where a reader elsewhere sees “apple maggot” used online, it is worth checking which of the two is meant, since the symptoms, timing and controls differ.
A fly caught mid-evolution
This species is native to northeastern North America, where wild hawthorn is its original host and remains a common one today. It took roughly a century after apple orchards were established in the region for the fly to begin using the new fruit at any scale, a shift well documented enough to serve as a standard example in evolutionary biology of a population splitting into host-specific races within a genetically observable number of generations. Having adapted to apple, it has since spread through most of the apple-growing regions of the eastern and midwestern United States and Canada, and reached parts of California, Oregon, Washington and Utah following an accidental introduction there in the late 1970s.
It has never established outside North America, and both Europe and Australasia treat a suspected finding as reportable rather than routine.
What to do about it
Hang red sphere traps, coated in sticky adhesive and ideally apple-scent baited, in the outer canopy from mid-June, and treat five or more flies on a trap as the point to act.
Collect and destroy fallen fruit at least twice a week through late summer.
Manage or remove wild hawthorn growing near a valued apple tree, since it is this fly’s original host and a likely source of reinfestation each year.
Bag individual fruitlets on a garden-scale tree where the crop is small enough to make this practical.
What it gets mistaken for
Codling moth, present nearly everywhere apples are grown including within North America, tunnels straight to the core through one obvious round hole plugged with dry frass, a different pattern from this species’ network of internal trails starting from a barely visible surface dimple. The two are different insects on different biological paths and only this one is the “apple maggot” of North American usage.
Not established in Europe, Australia and New Zealand
Do not prune, spray or otherwise treat a suspected case. Doing so risks spreading an organism the country has kept out, and it disturbs the evidence needed to identify it. Photograph what you can see, leave the plant alone, and contact your national or state plant health authority. The control advice further down this page is written for regions where this problem is already established.
Native to northeastern North America, where its original and still common host is wild hawthorn rather than apple. It took roughly a hundred years after apple orchards were established in North America for the fly to begin using the new fruit, a documented shift now treated as a textbook case of a species evolving a new habit within a few dozen generations. It has since spread through most of the apple-growing regions of the eastern and midwestern United States and Canada, and reached parts of California, Oregon, Washington and Utah after an accidental introduction there in the late 1970s. It has never established outside North America, and it is distinct from codling moth, a European moth that does comparable damage to apples worldwide; despite both being loosely called "apple maggot" in casual conversation, they are unrelated insects on different continents doing similar jobs.
What to do, in order
The steps below apply where this problem is already established.
Start here
Prevention, and the changes that stop the problem returning. Most of these pages should end at this tier.
- Remove or manage wild hawthorn near an orchard
- Hawthorn is this fly's original and still preferred host in many areas, and a hedge or wild tree nearby is a common source of the flies that go on to infest a garden apple tree. Removing hawthorn within range of a valued apple planting, or at minimum monitoring it for the same damage, reduces the population arriving each summer.
- Collect and destroy fallen fruit promptly
- Larvae leave dropped fruit to pupate in the soil beneath the tree. Picking up windfalls at least twice a week through late summer and binning or destroying them, rather than composting them nearby, cuts off a generation before it completes its cycle.
Then reach for a barrier
Netting, hand removal and water. Nothing here harms anything except the target.
- Hang red sphere traps coated in sticky adhesive from mid-June
- A bright red sphere the size of an apple, coated in a sticky substance and often baited with an apple-scent lure, mimics a ripening fruit closely enough to draw egg-laying females in. Hanging traps in the outer third of the canopy by mid-June and checking them regularly both catches flies directly and gives an early warning: five or more flies on a trap is the standard threshold at which further action is worth taking.
- Bag individual fruit
- Slipping a small paper or fine mesh bag over individual fruitlets once they have set, and leaving it in place until picking, excludes egg-laying flies from anything that can practically be covered on a garden-scale tree.
Then bring in the predators
Encourage what already lives in the garden, and buy predators in where the problem is under glass and nothing will arrive on its own.
- Encourage generalist predators and avoid broad-spectrum sprays near fruit
- Ground beetles and other generalist predators take pupae in the soil, and preserving that background predation by limiting unnecessary insecticide use gives a modest additional reduction alongside trapping and sanitation.
Biological controls are live organisms and their sale and release are regulated country by country. An agent sold freely in one place may be unapproved in another, so buy from a licensed supplier where you live and never import or move one yourself.
Plants this turns up on
Guides that name it among the problems to watch for. The list is the plants it is characteristic of rather than everything it will feed on.