A bird flies past Twitter Inc. signage displayed outside the company's headquarters in San Francisco, California. David Paul Morris | Bloomberg | Getty Images

SAN FRANCISCO — If there was a tipping point, a moment that crystallized the anger building here toward the so-called technorati for driving up housing prices and threatening the city's bohemian identity, it came in response to a diatribe posted online in August by a young Internet entrepreneur. The author, a start-up founder named Peter Shih, listed 10 things he hated about San Francisco. Homeless people, for example. And the "constantly PMSing" weather. And "girls who are obviously 4s and behave like they're 9s." The backlash was immediate. Fliers appeared on telephone poles calling Mr. Shih a "woman hatin' nerd toucher." CheapAir offered him a free ticket back to New York. Readers responded that what they hated about San Francisco were "entitled" technology workers like him. (Read more: Who made Consumer Reports' 'Naughty & Nice' list?) Mr. Shih, who said he received death threats after the post, deleted it and apologized.

But a nerve had been struck. As the center of the technology industry has moved north from Silicon Valley to San Francisco and the largess from tech companies has flowed into the city — Twitter's stock offering unleashed an estimated 1,600 new millionaires — income disparities have widened sharply, housing prices have soared and orange construction cranes dot the skyline. The tech workers have, rightly or wrongly, received the blame. Resentment simmers, at the fleets of Google buses that ferry workers to the company's headquarters in Mountain View and back; the code jockeys who crowd elite coffeehouses, heads buried in their laptops; and the sleek black Uber cars that whisk hipsters from bar to bar. Late last month, two tech millionaires opened the Battery, an invitation-only, $2,400-a-year club in an old factory in the financial district, cars lining up for valet parking.

For critics, such sights are symbols of a city in danger of losing its diversity — one that artists, families and middle-class workers can no longer afford. On the day of Twitter's public offering this month, 150 demonstrators protested outside the company with signs reading "People not profit" and "We're the public, what are you offering?"

More from The New York Times:

In Bitcoin's Orbit: Rival Virtual Currencies Vie for Acceptance

Signs of Change in News Mission at Bloomberg

The Weinstein Company, Seeking Hits, Shift to TV More and more longtime residents are being forced out as landlords and speculators race to capitalize on the money stream. Mary Elizabeth Phillips, a retired accountant, is fighting eviction from the rent-controlled apartment where she has lived for almost half a century. If her new landlords have their way, she will have to move in April, shortly after her 98th birthday, because they want to sell the units.

Her neighborhood has given way around her. The car dealership across the street is now a luxury apartment complex, complete with rooftop herb garden, a butterfly habitat and a Whole Foods.

"I can understand it from an investment standpoint," she said of her landlords' actions. "But I don't think I'd ever be that coldblooded about this."

While the technology boom has bred hostility, it has also brought San Francisco undeniable benefits. Mayor Edwin M. Lee credits the technology sector with helping to pull the city out of the recession, creating jobs and nourishing a thriving economy that is the envy of cash-starved cities across the country.

The industry is "not so much taking over but complementing the job creation we want in the city," Mr. Lee said while giving a tour of middle Market Street to show off its "renaissance" from a seedy skid row to a tech district where Twitter, Square and other companies have made their home.

Yet city officials must grapple with the arithmetic of squeezing more people into the limited space afforded by San Francisco's 49 square miles. And it is the housing shortage that underlies much of the sniping about tech workers.

(Read more: It's feeling in 1999 again, as a tech bubble looms)

San Francisco, California. Pgiam | E+ | Getty Images

San Francisco has the least affordable housing in the nation, with just 14 percent of homes accessible to middle-class buyers, said Jed Kolko, chief economist at the real estate website Trulia. The median rent is also the highest in the country, at $3,250 a month for a two-bedroom apartment. "Affordable housing projects are constructed, and the money set aside for that purpose is used, but the demand is just far greater than what can be supplied," said Fred Brousseau of the city budget and legislative analyst's office. Evictions under a provision of state law that allows landlords to evict rent-controlled tenants if they convert a building for sale have more than tripled in the past three years, just as they did during the first tech boom.

To Yelly Brandon, a 36-year-old hairstylist, and her boyfriend, Anthony Rocco, an archivist, the obstacles to finding housing became clear when they spent two months searching for an apartment. At open houses, they said, they were competing with young tech workers, who offered more than the asking price and cash up front.

"People were just throwing money in the air," Ms. Brandon said.

The influx of wealth is, in turn, changing the tenor of neighborhoods. Fort Mason, a renovated military post on the bay, has been nicknamed "Frat Mason" for the 20-something "tech bros" — tech company salespeople, marketing employees and start-up founders — who have moved into luxury apartments there and play bocce on the great lawn.

Nowhere are the changes starker than in the Mission District, once a working-class Hispanic neighborhood, now a destination for the tech elite.

Evan Williams of Twitter and Mark Zuckerberg of Facebook have bought homes near there.

Longtime residents of the Mission District complain that high-end apartments, expensive restaurants and exclusive boutiques are crowding out the bodegas, bookstores and Mexican bars. They complain about workers who, like residents of a bedroom community, board company buses every morning and return every evening to drink and dine on Valencia Street. And they grumble about less tangible things: an insensitivity in interactions in stores and on the street, or a seeming disregard for neighborhood traditions. The annual Day of the Dead procession, meant to be solemn, has turned into a rowdy affair that many newcomers seem to view as a kind of Mexican Halloween. "Some of the people in the stores that I knew, they are good people and nice people, and then I see them get evicted and then the people who move in there are not as nice," said Rene Yañez, an artist and founder of Galería de la Raza in the 1970s, who started the procession. Mr. Yañez and his partner, who is battling cancer, are being evicted from the apartment they have occupied for decades.

Evictions are higher in this neighborhood than in any other part of the city.

"They are not only expelling the homeless and the gangbangers," said Guillermo Gómez-Peña, a performance artist. "They are also expelling the performance artists, the poets, the muralists, the activists, the working-class families — all these wonderful urban tribes that made this neighborhood a very special neighborhood for decades."

"One day," he added, "they will wake up to an extremely unbearable ocean of sameness."

(Read more: Traders expect a rocky week for markets—here's why) Some tech companies are trying to give back. Salesforce has donated millions of dollars to the public schools, and Twitter, which declined to comment on its effect on the city, is providing lawyers to help fight evictions, under an agreement with the city in exchange for tax breaks.