Under Mexican rule, the mission system gradually ended, and its lands became privatized. In , Englishman William Richardson erected the first independent homestead,  near a boat anchorage around what is today Portsmouth Square. Together with Alcalde Francisco de Haro , he laid out a street plan for the expanded settlement, and the town, named Yerba Buena , began to attract American settlers. Montgomery arrived to claim Yerba Buena two days later. Yerba Buena was renamed San Francisco on January 30 of the next year, and Mexico officially ceded the territory to the United States at the end of the war.
Despite its attractive location as a port and naval base, San Francisco was still a small settlement with inhospitable geography. Hanhart Chromolithograph Port of San Francisco in The California Gold Rush brought a flood of treasure seekers known as "forty-niners", as in "". With their sourdough bread in tow,  prospectors accumulated in San Francisco over rival Benicia ,  raising the population from 1, in to 25, by December By the harbor was extended out into the bay by wharves while buildings were erected on piles among the ships.
By Yerba Buena Cove had been filled to create new land. Buried ships are occasionally exposed when foundations are dug for new buildings. Silver discoveries, including the Comstock Lode in Nevada in , further drove rapid population growth.
Early winners were the banking industry, with the founding of Wells Fargo in and the Bank of California in Development of the Port of San Francisco and the establishment in of overland access to the eastern U. Catering to the needs and tastes of the growing population, Levi Strauss opened a dry goods business and Domingo Ghirardelli began manufacturing chocolate. Immigrant laborers made the city a polyglot culture, with Chinese Railroad Workers , drawn to "Old Gold Mountain", creating the city's Chinatown quarter.
The city's sea of Victorian houses began to take shape, and civic leaders campaigned for a spacious public park, resulting in plans for Golden Gate Park. San Franciscans built schools, churches, theaters, and all the hallmarks of civic life. The Presidio developed into the most important American military installation on the Pacific coast.
Around , San Francisco was a major city known for its flamboyant style, stately hotels, ostentatious mansions on Nob Hill , and a thriving arts scene.
As buildings collapsed from the shaking, ruptured gas lines ignited fires that spread across the city and burned out of control for several days. With water mains out of service, the Presidio Artillery Corps attempted to contain the inferno by dynamiting blocks of buildings to create firebreaks. Many fled permanently to the East Bay. San Francisco is gone. Rejecting calls to completely remake the street grid, San Franciscans opted for speed.
City Hall rose again in splendid Beaux Arts style, and the city celebrated its rebirth at the Panama-Pacific International Exposition in The Bay Bridge , under construction in , took forty months to complete. In ensuing years, the city solidified its standing as a financial capital; in the wake of the stock market crash , not a single San Francisco-based bank failed. It was in this period that the island of Alcatraz , a former military stockade, began its service as a federal maximum security prison, housing notorious inmates such as Al Capone , and Robert Franklin Stroud , The Birdman of Alcatraz.
San Francisco later celebrated its regained grandeur with a World's fair , the Golden Gate International Exposition in —40, creating Treasure Island in the middle of the bay to house it. After the end of the war, many military personnel returning from service abroad and civilians who had originally come to work decided to stay. Urban planning projects in the s and s involved widespread destruction and redevelopment of west-side neighborhoods and the construction of new freeways, of which only a series of short segments were built before being halted by citizen-led opposition.
Over this period, San Francisco became a magnet for America's counterculture. Beat Generation writers fueled the San Francisco Renaissance and centered on the North Beach neighborhood in the s.
In San Francisco, the quake severely damaged structures in the Marina and South of Market districts and precipitated the demolition of the damaged Embarcadero Freeway and much of the damaged Central Freeway , allowing the city to reclaim The Embarcadero as its historic downtown waterfront and revitalizing the Hayes Valley neighborhood.
Two recent decades have seen two booms driven by the internet industry. First was the dot-com boom of the late s, startup companies invigorated the San Francisco economy. Large numbers of entrepreneurs and computer application developers moved into the city, followed by marketing, design, and sales professionals, changing the social landscape as once-poorer neighborhoods became increasingly gentrified.
When the bubble burst in , many of these companies folded and their employees were laid off. Yet high technology and entrepreneurship remain mainstays of the San Francisco economy. By the mids decade , the social media boom had begun, with San Francisco becoming a popular location for tech offices and a popular place to live for people employed in Silicon Valley companies such as Apple and Google.
Cars navigate Lombard Street to descend Russian Hill. There are more than 50 hills within city limits. Near the geographic center of the city, southwest of the downtown area, are a series of less densely populated hills.
Twin Peaks , a pair of hills forming one of the city's highest points, forms a popular overlook spot. The nearby San Andreas and Hayward Faults are responsible for much earthquake activity, although neither physically passes through the city itself. The San Andreas Fault caused the earthquakes in and Minor earthquakes occur on a regular basis. The threat of major earthquakes plays a large role in the city's infrastructure development. The city constructed an auxiliary water supply system and has repeatedly upgraded its building codes, requiring retrofits for older buildings and higher engineering standards for new construction.
Entire neighborhoods such as the Marina , Mission Bay , and Hunters Point , as well as large sections of the Embarcadero , sit on areas of landfill. Treasure Island was constructed from material dredged from the bay as well as material resulting from the excavation of the Yerba Buena Tunnel through Yerba Buena Island during the construction of the Bay Bridge. Such land tends to be unstable during earthquakes.
The resulting soil liquefaction causes extensive damage to property built upon it, as was evidenced in the Marina district during the Loma Prieta earthquake.