In an interview with Oprah Winfrey, McCarthy said that the inspiration for the book came during a 2003 visit to El Paso, Texas, with his young son. Imagining what the city might look like fifty to a hundred years into the future, he pictured "fires on the hill" and thought about his son. He took some initial notes but did not return to the idea until a few years later, while in Ireland. Then, the novel came to him quickly, and he dedicated it to his son, John Francis McCarthy.
In an interview with John Jurgensen of The Wall Street Journal, McCarthy talks about conversations he and his brother would have about different scenarios for an apocalypse. One of the scenarios involved survivors turning to cannibalism: "when everything's gone, the only thing left to eat is each other."