If you trek all the way down to Ghirardelli Square, which of course locals rarely do, and get into that long line of tourists, you can smell it — chocolate in the air. Ghirardelli doesn’t actually manufacture chocolate in San Francisco anymore, but that doesn’t diminish the gloss of the Original Ghirardelli Ice Cream & Chocolate Shop, with its exposed brick, brass rails, and two levels’ worth of old-timey equipment and fun history facts. Not to mention: gooey hot fudge sundaes. Melted down daily from wafers, the fudge is ultra smooth, with the telltale sheen of emulsifiers and stabilizers, and an aroma that billows out onto the square the same way Cinnabon cinnamon scents a mall.

Chocolate has a rich history in San Francisco, from the first miners seeking gold to modern makers refining beans. Get a taste for that tradition first — then, just in time for Valentine’s Day, keep scrolling to the bottom for some last-minute gift suggestions.

The History of Chocolate in San Francisco

It’s a fun fact that Ghirardelli is the oldest continuously run chocolate factory in the United States. Beyond that, once you start scraping the bottom of the bowl, you can almost taste the entire timeline of America’s chocolate legacy — starting as far back as the Gold Rush days, when French and Italian immigrants first started producing chocolate on a large scale, and progressing to Scharffen Berger’s small-batch revolution at the end of the millennium. Then there’s Dandelion’s gleaming new factory, whose California sensibility — chasing down the best ingredients and treating them as lightly as possible — is helping to lead the craft chocolate movement today. In that way, taking a spin back through San Francisco’s chocolate factories is like sifting through the archives of chocolate in America.

Ghirardelli was founded in 1852, well before Hershey’s in 1894 or Nestlé Tollhouse in 1939. Domingo (born Domenico) Ghirardelli was an Italian immigrant who came over during the Gold Rush, first opening a general store in Stockton, then a candy shop on Kearny. The factory moved into the Pioneer Woolen Building on the waterfront in 1893, where Ghirardelli Square resides today. Extraordinarily, it survived the 1906 earthquake, going back to business after only 10 days. Its days as a small, homegrown business in San Francisco are long past, however: Now the company is owned by Lindt, a global giant, and its chocolate is milky sweet and mass produced at its facilities in San Leandro.

What’s less well known is that San Francisco is also home to one of the oldest family-owned chocolate factories in the country: Guittard, which has managed to remain independent and even evolve over the centuries. The company was founded in 1868, only 16 years after Ghirardelli, and everyone has been confusing the rival original G’s ever since. Etienne (“Eddy”) Guittard was a French immigrant who showed up a little late to the rush, and instead found his fortunes in the grinding business, keeping miners in coffee, tea, and chocolate. His original factory on Sansome burned in the quake, and the family rebuilt on Main, near the then waterfront where the ships unloaded beans. Making way for a freeway, the factory finally moved to Burlingame in 1954, and it’s run by the fourth and fifth generations of the family today.

Gary Guittard, the current president and fourth generation of the family, still remembers roaming the old factory on Main as a 6-year-old, chasing his brother through the narrow and winding three-story brick building, and getting tricked into tasting the bitter chocolate liquor. “It was so cool. I would give anything to still have [that building] today,” Guittard says. “Can you imagine? It was dark and not very big at all. Mostly I remember the smells. We roasted on the third floor, and just the smell of the place. ”

But while American chocolate has long been dismissed by the rest of the world for being overly milky and sweet, Scharffen Berger blazed into town at the end of the millennium and pioneered a style of domestic dark chocolate that was bold and flavorful. Robert Steinberg, a former doctor, and John Scharffenberger, a winemaker, founded the company in 1997, bringing an oenophile’s palate to the business. Unlike previous makers, they took chocolate just as seriously as wine. Scharffen Berger began roasting and grinding beans in small batches, bringing out darker and more dramatic flavor. Notably, the company claims it was the first to put percentages of cacao on labels, at least in the United States, leading the way for the entire country.

Scharffenberger quickly made like-minded friends in the local chocolate scene. Michael Recchiuti is a local confectioner who doesn’t make chocolate himself, but melts and shapes it into truffles and confections, a distinct expertise. (“In France, I’d be called a fondeur or melter,” he clarifies.) He started his own business the same year as Scharffen Berger, selling confections flavored with everything from farm-fresh lemon verbena to pink peppercorns at the Ferry Building. While setting up shop, when he heard about what Scharffenberger was up to. “I was like, that’s so cool, no one makes chocolate,” he says. “It’s kind of like toilet paper — everyone takes chocolate for granted. No one really thinks about where it comes from.” Recchiuti says he’ll never forget when Scharffenberger showed up on his doorstep with one of the first big bars of chocolate to give him a powerful taste.

“I was like, that’s so cool, no one makes chocolate .... It’s kind of like toilet paper — everyone takes chocolate for granted.”

“When John Scharffenberger came onto the scene, it really changed our philosophy,” Guittard says. “It opened up my eyes on chocolate flavor.” Guittard realized that if his great-grandfather’s company was going to compete in the next millennium, it needed to evolve. He started flying down to Ecuador, Jamaica, and Madagascar to personally meet with farmers, where he’d occasionally run into Steinberg at distant airports. He says it took six or seven years to finally figure out how to make a better chocolate. “We changed everything: time, temperature, flavor. We re-trained the entire team and put much tighter parameters on each step, to bring out the best in each bean. We modify by bean, because you can’t roast and grind an Ecuador like a Madagascar. It totally depends on what that bean likes.”

Twenty years later, Dandelion Chocolate is the next luminary, taking that strong chocolate flavor and breaking it out into distinct profiles. Dandelion opened its dazzling new facility on 16th Street last year, and it honors the tradition of the chocolate factories that came before it, complete with exposed brick, big beams, and brass details. But Dandelion’s obsession is single origins: Each bar of chocolate, wrapped up like a golden ticket, features one type of bean from a particular place. Dandelion uses only cacao beans and sugar, so there’s nothing to mask the pure flavor of the beans. Unlike the big manufacturers, like Hershey’s or Ghirardelli, who pull most of their beans from Africa, roast them all at the same high temperature, and then put in lots of additives to make them taste good, it’s a much more finely calibrated approach. And in addition to putting percentages on labels, they’re adding tasting notes, from brownies and bananas to tart red fruit and sultry tobacco.

“There are so many unique flavor profiles I get to work with,” says chef Lisa Vega, who crafts all of the dessert offerings in the restaurant and shop. “For example, say you want to make an apple pie. You go to the farmers market and try all of the different apples, which all have different tasting notes and textures, whether tart or crunchy. You finally get to experience chocolate in that way, when you have access to all these different origins.” If you’ve only ever had Ghirardelli’s milk chocolate squares, taking that first bite of a Dandelion bar is a wildly different experience. Dandelion describes the flavor of a bar made from a single estate in Costa Rica as having “notes of golden caramel, ganache, and waffle cone.” Another, from Madagascar, evokes tart fruit, in the form of “raspberry cheesecake and lemon zest.”

Ghirardelli and Scharffen Berger are now both owned by larger companies, Ghirardelli by Lindt and Scharffen Berger by Hershey’s. (Robert Steinberg died in 2008 at the age of 61, a few years after John Scharffenberger sold the company, in 2005.) Guittard and Dandelion are carrying on the local tradition. “Personally, I feel a lot of the bean-to-bar companies are building on what [Scharffenberger] did,” Guittard reflects. “I think Dandelion is as much of a retail and restaurant experience, which is good for chocolate, and great for people to better understand the process.” At the heart of the Dandelion Factory, Bloom Chocolate Salon is a sit-down restaurant serving breakfast, afternoon tea, a flight of chocolate cakes, a flight of ice creams, and of course, hot chocolate. If Scharffenberger was the trailblazer, Dandelion is finally bringing more attention to the craft, showcasing the chocolate-making process in a factory that is literally transparent, with glass windows allowing customers to watch the bar-making process.

Spinning back through the centuries, there are still so many ways to savor San Francisco’s rich chocolate history: digging into a hot fudge sundae at Ghirardelli Square, baking a batch of brownies with Scharffen Berger’s dark squares, making cookies with Guittard’s award-winning chocolate chips, or savoring Dandelion’s bars made from beans circling the equator. And if you want a box of chocolates for your sweetheart or yourself, you can go visit Recchiuti at the Ferry Building. Recchiuti, like most chocolatiers and pastry chefs, favors Valrhona, the French brand that’s the gold standard in pro kitchens. But he also dabbles in Guittard, which sells to a handful of other local restaurants, bakeries, and creameries as well, including Mister Jiu’s, Che Fico, Jane Bakery, and Bi-Rite Creamery.

“A lot of home bakers know us through the baking aisle,” says Amy Guittard, who’s joining her father as the fifth generation of the family. “But I always say, you’re probably eating more of our chocolate than you realize.”

The Sweetest Chocolate Gifts in San Francisco

Cramming to find a last-minute Valentine’s gift? Here are seven ideas featuring chocolate that was actually made here in San Francisco. Bonus: They all have pretty packaging.

Dandelion Wrapped Three-Bar Gift Set, $35

Three locations: 2600 16th Street (8 a.m. to 8 p.m.), 740 Valencia Street (Sunday to Thursday 10 a.m. to 11 p.m., Friday and Saturday to midnight), and Ferry Building (Sunday 9 a.m. to 7 p.m., Monday to Wednesday 8 a.m. to 6 p.m., Thursday to Saturday 8 a.m. to 9 p.m.)

Nuubia After Dark Chocolates, featuring Dandelion Chocolate, $55

Three locations: 2600 16th Street (8 a.m. to 8 p.m.), 740 Valenncia Street (Sunday to Thursday 10 a.m. to 11 p.m., Friday and Saturday to midnight), and Ferry Building (Sunday 9 a.m. to 7 p.m., Monday to Wednesday 8 a.m. to 6 p.m., Thursday to Saturday 8 a.m. to 9 p.m.)

Feve Valentine’s Day Collection, $28

Location: 2222 Palou Avenue (Monday to Friday 10 a.m. to 5 p.m.)

Recchiuti Chemistry of Love Truffles, $28

Two locations: Ferry Building (Monday to Friday 10 a.m. to 7 p.m., Saturday 8 a.m. to 6 p.m., Sunday 10 a.m. to 5 p.m.), 801 22nd Street (Tuesday to Friday noon to 7 p.m., Saturday 11 a.m. to 6 p.m.)

Recchiuti Black Box, $48

Two locations: Ferry Building (Monday to Friday 10 a.m. to 7 p.m., Saturday 8 a.m. to 6 p.m., Sunday 10 a.m. to 5 p.m.), 801 22nd Street (Tuesday to Friday noon to 7 p.m., Saturday 11 a.m. to 6 p.m.)

Guittard Eureka Works Semisweet Chocolate, $8.99

Available through Whole Foods, Mollie Stone’s, Bi-Rite, and other local markets

Guittard Akoma Extra Semisweet Chocolate Chips, $6.99

Available through Whole Foods, Mollie Stone’s, Bi-Rite, and other local markets