Using cell-specific ablation of Egr2 and mixed bone marrow chimeric mice, we show that cell-intrinsic EGR2 is indispensable for the tissue-specific identity of alveolar macrophages and their ability to control infection with a major respiratory pathogen, Streptococcus pneumoniae. This evidence concerns the gene EGR2 and infection.