The earth already does that, we just call it our ecosystem. It's why we have clean water, carrots, coal and, and the end the chain, the internet to talk about it.
All this becomes relatively easy if you have a lot of cheap power. And you would not get it just by power saving and eficiency improvements, only with research and building of new sources.