Is a Linux executable “compatible” with OS X?

No, Linux and Mac OS X binaries are not cross-compatible.

For one thing, Linux executables use a format called ELF.

Mac OS X executables use Mach-O format.

Thus, even if a lot of the libraries ordinarily compile separately on each system, they would not be portable in binary format.

Furthermore, Linux is not actually UNIX-based. It does share a number of common features and tools with UNIX, but a lot of that has to do with computing standards like POSIX.

All this said, people can and do create pretty cool ways to deal with the problem of cross-compatibility.


Finally, to address your point on byte-code: when making a binary, compilers usually generate machine code that is specific to the platform you’re developing on. (This isn’t always the case, but it usually is.)

Leave a Comment