The symptoms of obsessive–compulsive disorder (OCD) are suggestive of cognitive rigidity, and previous work identified impaired flexible responding on set-shifting tasks in such patients. The basal ganglia are central to habit learning and are thought to be abnormal in OCD, contributing to inflexible, rigid habitual patterns of behaviour. Here, we demonstrate that increased cognitive inflexibility, indexed by poor performance on the set-shifting task, correlated with putamen morphology, and that patients and their asymptomatic relatives had common curvature abnormalities within this same structure. The association between the structure of the putamen and the extradimensional errors was found to be significantly familial in OCD proband–relative pairs. The data implicate changes in basal ganglia structure linked to cognitive inflexibility as a familial marker of OCD. This may reflect a predisposing heightened propensity toward habitual response patterns and deficits in goal-directed planning.