Gut bacterial communities provide flexibility to hosts during dietary changes. Despite the increasing number of studies exploring the associations between broader dietary guilds of mammalian hosts and their gut bacteria, it is generally unclear how diversity and variability in consumed diets link to gut bacteria in wild non-primate mammals. Here we contribute to filling this gap by exploring consumed diets and gut bacterial community compositions with metabarcoding of faecal samples for two African mammals, Civettictis civetta and Genetta spp., from the family Viverridae. For each individual sample, we characterised bacterial communities and identified dietary taxa by sequencing vertebrate, invertebrate, and plant markers. This led us to establish diet compositions that diverged from what has previously been found from visual identification methods. Specifically, while the two genera have been categorised into the same dietary guild, we detected more animal dietary items than plant items in C. Civetta, while in Genetta spp. we observed an opposite pattern. We further found that individuals with similar diets have similar gut bacterial communities in both species. This association tended to be driven by specific associations of dietary items to specific gut bacterial taxa, rather than entire communities, implying diet-driven selection for specific gut microbes in individual wild hosts. Our findings underline the importance of molecular tools for improving characterisations of wild mammalian diets and highlight the opportunities for simultaneously disentangling links between diets and gut symbionts. Such insights can inform robustness and flexibility in host-microbe symbioses to dietary change associated with seasonal and habitat change.