Coffee has a long history in SF, going at least back to the Gold Rush when (what became) James Folger started serving coffee to the miners and other new residents of the new city.
Today "Coffee" should probably be two categories... like most urban areas, coffee is available almost anywhere - the places tagged for coffee in this guide are notable for some reason besides simply having coffee.
Except for =>
➊ Sightglass, the current (and youngest) drip coffee darling of SF's caferati.
➋ Blue Bottle, the espresso favorite and fastest-growing (location-wise) of the coffee titans with some of the coolest locations around including a Hayes Valley garage and a rooftop sculpture garden cafe at MOMA, etc.
➌ Four Barrel, the former drip coffee darling and most interestingly/eclectically furnished outfit.
➍ Ritual, the oldest of the current class still holds a serious hold on the Mission despite Four Barrel's nudging in.
Otherwise, Philz isn't held in the same regard by purists, but somehow there is always a line (!) and Caffé Trieste in North Beach served the first west-coast espresso in 1956 and was a hub of activity for the Beat movement.