Selected examples 2,4-diamino-7H-pyrrolo [2,3-d]pyrimidines with a phenyl or benzyl group at the 5-position were synthesized as inhibitors of dihydrofolate reductase (DHFR) from Pneumocystis carinii and Toxoplasma gondii, two potentially life-threatening opportunistic pathogens associated with AIDS and other disorders of the immune system. Aldol condensation of paraformaldehyde with substituted benzaldehydes or with phenylacetaldehyde afforded α-hydroxyketones with a phenyl or benzyl group at the 4-position. Further reaction of the hydroxyketones with malononitrile afforded 2-aminofuran-3-carbonitriles, which upon heating with guanidine underwent ring transformation/ring annulation to produce 2,4-diamino-7H-pyrrolo[2,3-d]pyrimidines rather than 2,4-diaminofuro[2,3-d]pyrimidines. One of the target compounds obtained in this manner, 2,4-diamino-5-(3,4,5-trimethoxyphenyl)-7H-pyrrolo[2,3-d]pyrimidine (1d), may be viewed as a conformationally restricted analogue of trimethoprim, an antimicrobial agent widely used in combination with a sulfa drug to treat P. carinii and T. gondii opportunistic infections in patients with AIDS. Compound 1d inhibited P. carinii and T. gondii DHFR with IC 50 values of 8.3 and 14 µM, respectively. This potency was somewhat greater than that of trimethoprim. However, because this compound was also more potent than trimethoprim against mammalian (rat liver) DHFR rat liver it lacked species selectivity. The other 2,4-diamino-7H-pyrrolo[2,3-d]pyrimidines synthesized were neither potent nor selective.