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.
closed as too broad by Tetsujin, jksoegaard, jaume, Mark, Graham Miln Aug 24 '18 at 9:57
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
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.).
The CPU is running a program. The binary contains data read by this program. Based on the values of the 1's and 0's in this data, the program (running inside the CPU) determines where to transfer data from various storage locations inside and outside of the CPU. Many of the transfers pass the data through logic which perform operations. Addition and multiplication are examples of such operations. There is much addition hardware beyond just the CPU. This additional hardware operates in parallel with the CPU to transfer the data to and from various peripherals.