Earlier quoted context omitted.
You can do it in a VM just fine too. There is usually someone who’ll point out that this probably violates licensing, and it probably does if you do it on non-Apple hardware.
I have an older Mac model I use as a linux box: you just reminded me I install a Mac OS VM without violating the license - thanks!
It was definitely a fun project even if not terribly useful.