Diet has a strong influence on the intestinal microbiota in both humans and animal models. It is well established that microbial colonization is required for normal development of the immune system and that specific microbial constituents prompt the differentiation or expansion of certain immune cell subsets. Nonetheless, it has been unclear how profoundly diet might shape the primate immune system or how durable the influence might be. We show that breast-fed and bottle-fed infant rhesus macaques develop markedly different immune systems, which remain different 6 months after weaning when the animals begin receiving identical diets. In particular, breast-fed infants develop robust populations of memory T cells as well as T helper 17 (TH17) cells within the memory pool, whereas bottle-fed infants do not. These findings may partly explain the variation in human susceptibility to conditions with an immune basis, as well as the variable protection against certain infectious diseases.