The first time I tasted chamoy was in the Mexican border town of Eagle Pass, Texas. At a street cart vendor, chamoy apples sat alongside elotes and tamales. The tart Granny Smith was rolled in a thick paste that was sweet, salty, spicy and sour all at once.

As I took the first bite, I thought: "There is no way this is gonna work." But it did, and after that, the mere thought of chamoy made me salivate like a Pavlovian dog. I had to learn more about it.

In Mexico, chamoy comes in many forms. Originally, it was a salted dried fruit (saladito), traditionally made from prunus mume, more commonly known as an ume plum (even though it's technically a small, sour apricot). But other fruits like sour green mangoes or tamarind pods are common. Chamoy also comes as a sauce and seasoning powder, both spiked with Mexican chiles, as well as a golosina, or Mexican candy. It can be sprinkled on fruits and vegetables or drizzled on chips (especially tostilocos, tortilla chips topped with a variety of condiments). It can come as a fruit-and-chamoy paleta (Mexican popsicle) or raspado (shaved ice).

But this Mexican snack actually started off as a Chinese one, and took hundreds of years to work its way into popular Mexican culture. Rachel Laudan, the first food historian to track chamoy's journey, explains that it is "a Mexican rendering of see mui," a salty, dried apricot common in China, as well as the inspiration for Japanese umeboshi, a pickled, salted apricot.

Laudan isn't sure when see mui came to Mexico, but says that Asians have been migrating to the country since the 1560s in Spanish ships that traded Chinese silk and spices for silver.

Laudan only figured out chamoy's Chinese heritage because she had lived in Hawaii, where she encountered crack seed, which is essentially chamoy's sister.

Crack seed is a salted, preserved licorice-flavored apricot that is cracked so the exposed seed will impart flavor. She learned that the Cantonese name for crack seed is see mui, and it came to Hawaii with Chinese plantation workers in the 19th century. See mui is pronounced "see moy," which sounds like "chamoy." Mexico reinvented chamoy as a sauce and candy with chiles, while Hawaii launched entire stores dedicated to crack seed made from different types of fruit.

"I moved to Mexico in the mid-1990s," Laudan says, "and all of my Mexican friends agree that chamoy ... really wasn't around [nationally] until 1990." It spread in large part thanks to the major Mexican confectionery company Dulces Miguelito, which began mass-producing chamoy in the 1970s.

"It's a very important flavor for Mexicans, especially if you grew up in Mexico," chef Gabriela Camara says. She owns Cala and Tacos Cala in San Francisco, as well as several Mexico City restaurants. Camara grew up in both Mexico City and Tepoztlan, Morelos. She remembers eating Miguelitos chamoy on top of Cazares, spicy corn chips.

Dominica Salomon, chef and owner of Cosecha in Oakland, Calif., agrees that "It's typical of the Mexican palate — they want all of the different taste buds going off at the same time. And chamoy ties all of that in."

Salomon grew up in Los Angeles, and her first taste of chamoy was saladitos. "From as far back as I can remember, I always had a saladito in my mouth," she shares. "You'd have to keep it in your mouth a long time until it softened up so you could eat the dried fruit off of the seed."

But not all chefs like chamoy, especially because much of it is heavily processed. Silvana Salcido Esparza, owner of the Bario Cafe in Phoenix, has strong feelings against it.

"Ha, chamoy. I love to hate it," she says. "Sabritas [chips] is king in Mexico, and together with chamoy is making Mexico the most diabetic country in the world. And it's nothing that can't be produced naturally." She teaches children to make chamoy from plum or apricot marmalade, ground chile de arbol, lime juice and sea salt.

Norma Listman, a private chef and writer currently living in San Francisco, Nayarit, Mexico, agrees. She grew up eating chamoy candy and sauce on fruit, but as an adult feels it is "processed ... so I wanted to make my own."

Using tips from working in a Japanese restaurant that makes its own umeboshi, she blends salt-preserved underripe ume plum with hibiscus flowers, dried chiles, lime juice, vinegar, honey, salt, water and rose water. It's fitting that she uses an Asian pickle recipe as the base for her chamoy. It's part of the reason she moved near the Bahía de Banderas, Mexico, a base for international trade.

"It's full of Asian ingredients," she says. "I wanted to come here to study the huge Asian influence of the area."

Since that first chamoy apple, my interest has grown into a straight-up obsession. I carry a bottle of chamoy sauce in my purse, make Silvana Salcido Esparza's dip for mandarins and mangoes, and rim tamarind margaritas in Miguelitos chamoy powder. I've even found a Japanese farmer that grows ume, so come spring, I will be making my own homemade version. That apple was the first step down the rabbit hole of chamoy, and I'm not looking back.

Leena Trivedi-Grenier is a San Francisco-based food and culture writer. Her work can be found here.

Copyright 2017 NPR. To see more, visit http://www.npr.org/.