July 1945, the engineer Vannevar Bush—one of the founders of the Raytheon electronics corporation, and director of the federal Office of Scientific Research and Development during World War II—published a meditative essay in The Atlantic. The scientific community had mobilized during the war to develop the atomic bomb. Now, he urged, it should turn itself with the same energy to the organization of human knowledge. He envisioned a device that may seem eerily familiar today: a desklike piece of furniture he dubbed the “memex,” which would make available and searchable all the accumulated written works of humanity, compressing entire encyclopedias and scientific libraries into a few square inches, and serving as an “enlarged intimate supplement” to individual memory. The memex, Bush suggested, could enliven people under the shadow of nuclear destruction: It would enable humanity to access the tremendous record of human experience, and direct it toward a shared common good.

THE CODE: SILICON VALLEY AND THE REMAKING OF AMERICA by Margaret O’Mara Penguin Press, 512 PP., $30.00

How far the grim news from today’s technological frontier seems from Bush’s optimism. Amazon is rife with counterfeit and fakery. Facebook has been blamed for the dissemination of conspiracy theories and ethnic hatreds, and for allowing user data to be manipulated to influence elections. Uber can’t turn a profit even as its “gig economy” model undermines the notion of the steady job. YouTube’s algorithms sway restless young people to the most extreme racist right. Hand-held computers link us to the massive tech giants lurking in the background. There’s a whole genre of first-person essay about trying, and failing, to break addiction to the iPhone.

This was not how it was all supposed to turn out. For many years, Silicon Valley and the machines that came out of it were presented as personally, economically, and socially transformative, agents of revolution at both the level of the individual and the whole social order. They were democratizing, uncontrolled, anarchic, and new. Most of all, they were supposed to be fun—to open up a space of play and freedom. How is it, then, that just a few decades in, we find ourselves trapped in a dreary spectacle that seems to replicate the old patterns of exploitation and dominion in almost every sphere, but with a creepy new intimacy?

Margaret O’Mara’s book The Code: Silicon Valley and the Remaking of America traces just how our uneasy present deviated from what was promised at the outset. O’Mara embeds Silicon Valley in the sweep of American political history, offering a vision of the social landscape that produced the modern technology industry. She shows how Big Tech did not simply spring Athena-like from the brain of Steve Jobs, but rather took shape out of the dilemmas and possibilities of the Cold War, the particular culture of Northern California, and the economic debates of the 1970s and 1980s. What comes through most powerfully in her narrative are the wild social hopes once projected on to computers. These magical machines were supposed to provide a solution to the economic and political problems of the late twentieth century, a way to transcend and break free of the confining aspects of postwar capitalism. This was a feint, a way of imagining a miracle fix to tensions and conflicts that had no easy resolution. Computers, O’Mara suggests, have long been metaphors as much as machines.

At the end of World War II, nothing seemed particularly special about Silicon Valley. It was a predominantly agricultural community, known for growing cherries, apricots, and plums. In the 1950s, it developed into a distinctly unglamorous suburb dotted with bungalows, similar to dozens of others around the country. “Mid-1950s Santa Clara Valley was merely a smaller-scale Los Angeles, home to aerospace companies, light manufacturing, and some smart academic scientists,” O’Mara writes. Boston looked far more likely to emerge as the technological capital of the future: It had MIT, Harvard, and easier access to the pools of money and investors needed. Computer experimentation was happening all over the United States.