When he was thirty-five, Kieran Setiya had a midlife crisis. Objectively, he was a successful philosophy professor at the University of Pittsburgh, who had written the books “Practical Knowledge” and “Knowing Right from Wrong.” But suddenly his existence seemed unsatisfying. Looking inward, he felt “a disconcerting mixture of nostalgia, regret, claustrophobia, emptiness, and fear”; looking forward, he saw only “a projected sequence of accomplishments stretching through the future to retirement, decline, and death.” What was the point of life? How would it all end? The answers appeared newly obvious. Life was pointless, and would end badly.

Unlike some people—an acquaintance of mine, for example, left his wife and children to move to Jamaica and marry his pot dealer—Setiya responded to his midlife crisis productively. In “Midlife: A Philosophical Guide” (Princeton), he examines his own freakout. “Midlife” has a self-soothing quality: it is, Setiya writes, “a self-help book in that it is an attempt to help myself.” By methodically analyzing his own unease, he hopes to lessen its hold on him.

Setiya finds that the history of the midlife crisis is both very long and very short. On the one hand, he identifies a text from Twelfth Dynasty Egypt, circa 2000 B.C., as the earliest description of a midlife crisis and suggests that Dante might have had one at the age of thirty-five. (“Midway on life’s journey, I found myself / In dark woods, the right road lost.”) On the other, he learns that the term itself wasn’t coined until 1965, when a psychologist named Elliott Jaques wrote an essay called “Death and the Mid-life Crisis.” (Jaques quotes a patient’s eloquent lament: “Up till now, life has seemed an endless upward slope, with nothing but the distant horizon in view. Now suddenly I seem to have reached the crest of the hill, and there stretching ahead is the downward slope with the end of the road in sight.”) John Updike published “Rabbit Redux” in 1971. (“What you haven’t done by thirty you’re not likely to do.”) Richard Ford published “The Sportswriter” in 1986. (“You can dream your way through an otherwise fine life, and never wake up.”) In between, Gail Sheehy’s book “Passages: Predictable Crises of Adult Life,” published in 1977, explored the midlife crisis from a psychological point of view. Sheehy, an accomplished investigative journalist—she also wrote “The Secret of Grey Gardens”—became an anthropologist of middle age. After interviewing many midlifers, she concluded that women, too, experienced midlife crises; they just had them earlier than men. “The years 35 to 39 are the infidelity years for women,” she told People, in 1976. Having “packed their last child off to school,” middle-aged women “want to restore illusions of youthful appearance, romantic love.”

After Sheehy’s book was published, everybody seemed to be having a midlife crisis. Perhaps, Setiya writes, people married too early during the conservative postwar decades, then reëvaluated their lives as the counterculture flowered. On the whole, though, research on the frequency of midlife crises tends to be equivocal. Many long-term studies of well-being show that people actually get happier as they age. (This lends credence, Setiya suggests, to Aristotle’s view that we grow into a “prime of life,” with the body achieving its fullest development at thirty-five and the mind at forty-nine.) Other studies show that there is a “U-shaped curve” to life satisfaction, such that we’re happiest when we’re young and old and unhappiest in between. (There are even studies of great apes, conducted by zoologists, which show that they get sad in middle age.) “Shit happens in midlife,” Setiya writes, “with kids and parents, work and health.” He is drawn to the work of the German economist Hannes Schwandt, which shows that “younger people tend to overestimate how satisfied they will be, while midlifers underestimate old age.” According to this theory, we could avoid midlife crises by calibrating our expectations.

If you’re a jerk, it’s useful to have a midlife crisis; it gives your irresponsible behavior an existential sheen. Almost certainly, the term is overused. Still, having experienced a midlife crisis himself, Setiya ends up convinced that they are an ordinary part of a well-lived life. He identifies a number of intellectual traps into which even the most levelheaded people can fall. Many have to do with the way we think about freedom and choice. Because the lives of middle-aged people have settled into more or less permanent shapes, for instance, people in midlife often become nostalgic for the feeling of choosing: they think, I want to do my job because I want to do my job, not because I need to pay the bills. With philosophical exactitude, Setiya explains the flaws in this kind of thinking. Suppose, he writes, that you can have just one of three desirable things—A, B, or C, in order of preference. Because there’s value in having a choice, there are situations in which a choice between B and C is actually preferable to A. Even so, the satisfaction offered by choice has a limit. Most of the time, the value of B or C plus the value of choosing won’t actually add up to the value of A. It’s exciting to choose a new career, but you’ll probably end up with an inferior job; it’s fun to date again, but your new spouse probably won’t be better than your current one.

Some middle-aged people wonder if they shoulda, coulda, woulda, or spend time wishing they could undo their worst mistakes; Setiya, for instance, wonders if he should’ve become a doctor rather than a philosophy professor. He urges the middle-aged to think in detail about what the alternative realities they contemplate would actually entail. Thanks to the “butterfly effect,” he argues, the alternative world in which you hadn’t made those mistakes would almost certainly exclude many of the things you currently value. (Had you chosen a different career, your children might not exist.) Setiya points out that the decisions that vex us most in retrospect also tend to be choices between “incommensurable goods.” Should you have worked on your novel or spent time with your family? Become a musician or an engineer? In Setiya’s view, regrets over such choices are good signs, since they reflect a healthy, multidimensional appreciation of life. “To wish for a life without loss is to wish for a profound impoverishment in the world or in your capacity to engage with it,” he writes. (Someone with a darker sensibility might have put it differently: there is no escaping loss, no matter how rich your life is.)

To many people, the increasing proximity of death is the worst thing about middle age. It doesn’t seem to bother Setiya very much: he points out that immortality would probably get frustrating after a while, and suggests getting over your own death in advance by imagining yourself coming to terms with the death of a friend. Instead, what really unnerves him is midlife ennui—the creeping sense of aimlessness and exhaustion that sometimes overtakes people as they age. The problem, Setiya finds, is that there’s something intrinsically self-defeating about getting things done. Once you’ve done them, you can’t do them anymore. “Having a child, writing a book, saving a life—the completion of your project may be of value, but it means that the project can no longer be your guide,” he writes. There’s a sense in which all goal-directed behavior is ironic: “In pursuing a goal, you are trying to exhaust your interaction with something good, as if you were to make friends for the sake of saying goodbye.” Setiya quotes Arthur Schopenhauer, who argued that life “swings like a pendulum to and fro between pain and boredom”; according to Schopenhauer’s rather grim view of existence, we spend our days struggling, then are rewarded for struggle with emptiness. “This is the problem with being consumed by plans,” Setiya concludes. “They are schemes for which success can only mean cessation.”