The skin needs to balance tolerance of colonizing microflora with rapid detection of potential pathogens. Flexible response mechanisms would seem most suitable to accommodate the dynamic challenges of effective antimicrobial defense and restoration of tissue homeostasis. Here, we dissected macrophage-intrinsic mechanisms and microenvironmental cues that tune macrophage signaling in localized skin infection with the colonizing and opportunistic pathogen Staphylococcus aureus. Early in skin infection, the cytokine granulocyte-macrophage colony-stimulating factor (GM-CSF) produced by γδ T cells and hypoxic conditions within the dermal microenvironment diverted macrophages away from a homeostatic M-CSF- and hypoxia-inducible factor 1α (HIF-1α)-dependent program. This allowed macrophages to be metabolically rewired for maximal inflammatory activity, which requires expression of Irg1 and generation of itaconate, but not HIF-1α. This multifactorial macrophage rewiring program was required for both the timely clearance of bacteria and for the provision of local immune memory. These findings indicate that immunometabolic conditioning allows dermal macrophages to cycle between antimicrobial activity and protection against secondary infections.