These same factors prevailed at other aspiring tech hubs, notably Route 128 outside Boston, which housed several iconic firms, including Wang and Polaroid. Yet California eventually bested Route 128, and not just because the state had a clear edge when it came to winter weather.

The sources of its success, O’Mara contends, had to do with a host of regulations and legal decisions that governed how firms in the Valley did business. Foremost among these was California’s longstanding prohibition on noncompete clauses. This made it easy for employees to job-hop and share news of the latest innovations without fear of reprisal or recrimination. The turnover was staggering at Valley start-ups compared with established corporations such as I.B.M. on the other side of the country. But the creativity unleashed in the process left other regions far behind.

No less important was the passage of the Immigration and Naturalization Act of 1965, which unexpectedly led to an influx of newcomers, many of them skilled in the technical fields that are Silicon Valley’s bread and butter. Between 1995 and 2005, more than half the founders of companies in the Valley were born outside the United States.

But this was a later development. At first, Silicon Valley was the province of white guys in white shirts and crew cuts working for defense contractors and chip makers. They created what O’Mara memorably describes as a “profanity-laced, chain-smoking, hard-drinking hybrid of locker room, Marine barracks and scientific lab.” These men happily voted Republican, and had little interest in California’s counterculture, much less its increasingly visible feminist movement. As O’Mara notes, Silicon Valley’s gender imbalance dates back to a time when “girls and electronics didn’t mix.”

This is one of O’Mara’s strongest narrative threads: the casual misogyny that has defined Silicon Valley from past to present. She manages to bring the few women who did succeed to the forefront, most notably the programmer and entrepreneur Ann Hardy, who battled systemic sexism even as she wrote the code for many of the first computer time-sharing and networking applications built by the company known as Tymshare.

Men otherwise rule O’Mara’s book, even if, as the 1970s arrived, they increasingly came from the ranks of the phone phreaks and “longhairs.” They included Nolan Bushnell, the charismatic founder of Atari, whose band of merry nerd-bros smoked weed and made game controls shaped like breasts; the “Steves” — Wozniak and Jobs — whom one early capitalist, appalled by their lack of hygiene, described as “renegades from the human race”; and Jim Warren, the math professor and impresario who founded the West Coast Computer Faire in 1977 and published the influential, if offbeat, publication known as “Dr. Dobb’s Journal of Computer Calisthenics and Orthodontia.”