I agree with the general notion, but not with the specifics. That is:
It's nice to code on a system that "shares the exact same stack as what I host with", but just running on Linux is not doing it.
Except if you only ever host with one single stack.
Normally, you'd have different stacks for different projects, different technologies (Ruby, PHP, etc), others would have Apache, others NGINX, MySQL or Mongo, different major or minor versions, etc.
So, I find the best way is to setup a VM with each hosting environment and work on that. You get easily reproducible stack, snapshots, isolation, and a cleaner main OS X or Linux install. With one click on the next image, you can completely change your environment.