MacOS and Binary/CPU This question applies to all operating systems and hardware, but I was curious what is going on behind the scenes when you install an OS on hardware. I know that macOS comes preinstalled on Macbooks, but hypothetically speaking, if you had to install it, what is going on behind the scenes between machine code and CPU/quantum mechanics.
Each platform comes with one or more specific platform binary interfaces that define how operating systems (or stand-alone programs that are not operating systems) must be structured. 

The first run parts of an operating system is generally defined in binary machine code. The CPU will read the machine code, divide it into instructions and carry out those instructions. The instructions make up the operating system.

All operating systems running on a specific platform must abide to the same (or a small number of) binary platform interface. They again offer an application binary interface (ABI) to user programs running on top of the operating system. The ABI is a mix of the platform binary interface and specific requirements for that specific operating system. Some operating systems offers multiple ABIs.

A platform in these terms is a combination of a CPU architecture and model and various peripherals (for example a platform could be a Mac with an Intel x64 CPU, UEFI firmware interface, etc.).