Resistance bands, a pull-up bar and a TRX go a long way for a fraction of the cost and space of a gym. Not as effective as free weights (in my personal experience) for putting on a lot of new muscle, but still quite effective.
+1 to resistance bands. This has been life changing for me. Minimal space, fraction of cost, and I get to exercise in my home office, watching something useful (currently going through fast.ai videos). Double win.