Why can’t we compile 8086 Assembily for all OSs from any OS?


If Mac OS, Linux, and Windows (mostly) all use Intel’s 8086 64 bit instruction set, why can’t we compile 8086 64 assembly from any operating system to any other operating system? (e.g. compile a Mac OS executable from assembly in Windows). Surely it would just be a matter of knowing what the machine code is for any given instruction?