SAN FRANCISCO — This is the city of lost toy stores.

San Franciscans searching for the perfect toy gift this holiday season have had the added hurdle of finding a place to buy it. For some, that means a nice long drive to the suburbs.

In recent years, all of the major toy chain stores here have closed, including F.A.O. Schwarz, KB Toys and Toys "R" Us. The nearest Wal-Mart is across the Bay Bridge in Oakland, the nearest Target 15 minutes south.

That is considered a mixed holiday blessing in this anti-establishment enclave. Many residents are antagonistic toward big-box retailers and still wax nostalgic and wistful about the ghosts of toy stores past.

"There are more medical cannabis dispensaries than there are toy stores," joked John Dallas, a local real estate agent and the father of two young children. He buys his toys online or at a local hardware store.

From the toy industry's perspective, the city is an anomaly. Among the nation's 15 most populous cities, only San Francisco and Detroit do not have a Toys "R" Us, a Wal-Mart or a Target, which together account for more than 60 percent of retail toy sales, industry analysts said.

In San Francisco, the reasons for the stores' absence seem plainer than the nose on Barbie's face. Commercial real estate prices are high, while the proportion of children in the population — 15 percent — is the lowest of any big American city.

Zoning in some neighborhoods makes it difficult to build new chain and big-box stores. The chains that do have outlets here seem to emphasize productivity and technology — like Office Max and Office Depot, Staples and Best Buy (which took over the space that opened up when Toys "R" Us left in 2006).

The abdication of major toy retailers here is part of a broader industry consolidation; Toys "R" Us and KB Toys have downsized in recent years, their sales challenged in particular by Wal-Mart and Target. Still, their absence in such a wealthy and big city as San Francisco is "highly unusual," said Sean McGowan, a toy industry analyst with Needham & Co.

When it comes to toys, many San Franciscans tend to patronize a handful of local, cherished boutique retailers. Ambassador Toys, a stalwart here, has been packed of late. Some of the shoppers say they prefer the more intimate setting. Others complain the prices are higher than at the chain stores, and the selection less wide.