A series of 2-aminopyrimidines was synthesized as ligands of the histamine H4 receptor (H4R). Working in part from a pyrimidine hit that was identified in an HTS campaign, SAR studies were carried out to optimize the potency, which led to compound 3, 4- tert-butyl-6-(4-methylpiperazin-1-yl)pyrimidin-2-ylamine. We further studied this compound by systematically modifying the core pyrimidine moiety, the methylpiperazine at position 4, the NH2 at position 2, and positions 5 and 6 of the pyrimidine ring. The pyrimidine 6 position benefited the most from this optimization, especially in analogs in which the 6- tert-butyl was replaced with aromatic and secondary amine moieties. The highlight of the optimization campaign was compound 4, 4-[2-amino-6-(4-methylpiperazin-1-yl)pyrimidin-4-yl]benzonitrile, which was potent in vitro and was active as an anti-inflammatory agent in an animal model and had antinociceptive activity in a pain model, which supports the potential of H 4R antagonists in pain.