Last updated on late November 2022.
First and foremost: do not waste your time with Vagrant (VirtualBox is not ready yet) or docker-compose (which runs a production environment)
My goal here is to run a Mastodon instance on a laptop, but using a virtual machine of some sort, so to not install a lot of dependencies on the real one. I have found out that the best solution is to use a virtual machine running (Ubuntu) Linux and follow the manual installation instructions from the official guide. The official guide assumes that you will be running the dev environment within a Linux box, but I have found that to be able to run Mastodon inside a virtual machine, several small tweaks are necessary, hence this guide.
My hardware configuration: MBP M1 Pro with 16GB