Urban-living individuals are exposed to many environmental factors that may combine and interact to influence mental health. While individual factors of an urban environment have been investigated in isolation, no attempt has been made to model how complex, real-life exposure to living in the city relates to brain and mental health, and how this is moderated by genetic factors. Using the data of 156,075 participants from the UK Biobank, we carried out sparse canonical correlation analyses to investigate the relationships between urban environments and psychiatric symptoms. We found an environmental profile of social deprivation, air pollution, street network and urban land-use density that was positively correlated with an affective symptom group (r = 0.22, Pperm < 0.001), mediated by brain volume differences consistent with reward processing, and moderated by genes enriched for stress response, including CRHR1, explaining 2.01% of the variance in brain volume differences. Protective factors such as greenness and generous destination accessibility were negatively correlated with an anxiety symptom group (r = 0.10, Pperm < 0.001), mediated by brain regions necessary for emotion regulation and moderated by EXD3, explaining 1.65% of the variance. The third urban environmental profile was correlated with an emotional instability symptom group (r = 0.03, Pperm < 0.001). Our findings suggest that different environmental profiles of urban living may influence specific psychiatric symptom groups through distinct neurobiological pathways.