In much of southern Africa, the leopard (Panthera pardus) is the last remaining large carnivore outside protected areas. We collected leopard scat (n = 82) opportunistically to determine the diet of leopards on small livestock farms and an adjacent national park in semi‐arid Namaqualand, South Africa. We quantified prey availability using camera traps (n = 163 stations) in an 810 km2 grid. Leopards strongly preferred (D > 0.5) rock hyrax (Procavia capensis), red hartebeest (Alcelaphus buselaphus) and klipspringer (Oreotragus oreotragus), but goats (Capra hircus) were consumed in highest biomass. Conservation strategies to decrease livestock losses and minimise leopard persecution are needed in Namaqualand and more broadly on livestock farmland neighbouring‐protected areas.