Since the 1960s, San Francisco and the surrounding Bay Area have enacted strict zoning regulations. Among other restrictions, San Francisco does not allow buildings over 40 feet tall in most of the city, and has passed laws making it easier for neighbors to block developments. Partly as a result of these codes, from 2007 to 2014, the Bay Area issued building permits for only half the number of needed houses, based on the area's population growth. At the same time, there has been rapid economic growth of the high tech industry in San Francisco and nearby Silicon Valley, which has created hundreds of thousands of new jobs. The resultant high demand for housing, combined with the lack of supply, have caused dramatic increases in rents and extremely high housing prices. For example, from 2012 to 2016, the San Francisco metropolitan area added 373,000 new jobs, but permitted only 58,000 new housing units.
source: Wikipedia