Here's a script that creates and runs a virtual machine running Raspberry Pi OS Desktop or Lite with a GUI.
It is based on cGandom's guide on setting up a Raspberry Pi OS Lite VM without a GUI.
Quoting that guide:
"This isn't full-blown hardware emulation of the Raspberry Pi 4, but more about creating a virtual environment for the OS."
The main improvements made by this script over that guide are:
- working GUI (tested with Raspberry Pi OS Desktop, as well as frame-buffer and X-Server on Raspberry Pi OS lite)