[Solved] How to generate an executable file that can run both on macOS and Linux


You will have to compile the executable again on Linux in order to create a binary that runs on Linux.
Unless you setup a cross-compile environment for Linux on MacOSX (using Linux in a Virtual Machine will be easier though), then you could compile for Linux there.

Either way you will end up with 2 different binaries. You can’t create a single binary that will run on both Linux and MacOSX.

4

solved How to generate an executable file that can run both on macOS and Linux