Animals often regulate the intake and quantity of nutrients to maximise fitness through life‐history traits such as lifespan, but we still lack a proper understanding of how specific nutrients influence these traits. Here, I developed an algorithm which allowed me to create a nutrient‐specific database from literature data, and investigated how the requirements of protein (P) and carbohydrate (C) needed to maximise lifespan evolved across nine insect species. I found moderate evidence of a phylogenetic signal on the optimal ratio of protein to carbohydrate ratio (PC ratio) that maximised lifespan, suggesting that optimal PC ratio for lifespan could have evolved non‐independently among related species. I also found evidence for weak‐to‐strong sex‐specific optimal PC ratios for lifespan, suggesting that sex‐specific nutritional needs to maximise lifespan can emerge and persist in some species. Although limited in the number of species, the approach adopted here is portable to experiments with number of nutrients and, thus, can be used in complex comparative precision nutrition studies for insights into the evolution of animal nutrition.