In recent years, the bidirectional communication between the gut microbiome and the brain has emerged as a factor that influences immunity, metabolism, neurodevelopment and behaviour. Cross-talk between the gut and brain begins early in life immediately following the transition from a sterile in utero environment to one that is exposed to a changing and complex microbial milieu over a lifetime. Once established, communication between the gut and brain integrates information from the autonomic and enteric nervous systems, neuroendocrine and neuroimmune signals, and peripheral immune and metabolic signals. Importantly, the composition and functional potential of the gut microbiome undergoes many transitions that parallel dynamic periods of brain development and maturation for which distinct sex differences have been identified. Here, we discuss the sexually dimorphic development, maturation and maintenance of the gut microbiome–brain axis, and the sex differences therein important in disease risk and resilience throughout the lifespan.