Skip to main content
2 of 2
Modifed the original answer, added the extra assumption that $X$ is compactly generated.
Paul Fabel
  • 2k
  • 15
  • 23

No. Let $X$ be a compactly generated Hausdorff space which fails to be locally compact at precisely one point. Now take the Alexandroff compactification of $X$, adding exactly one new point, whose neighborhoods have compact complement in $X$. The new space is not Hausdorff, but has the property that it is compact, and each compact subspace is closed. In general the image of a compact space is compact, and hence each retract of the new space is a closed subspace of itself.

Paul Fabel
  • 2k
  • 15
  • 23