Apple - Is it possible to compile UNIX command line program for Apple Silicon architecture on Intel-based Mac?

The whole point of Universal Binaries is that you can compile the same code for 2 architectures, one of which (by necessity) is not the hardware you're running.

It has previously been possible to compile Universal Binaries for PPC and Intel, or 32-bit and 64-bit, regardless of the hardware doing the compiling.

Apple's documentation on porting to Apple Silicon (AS) is here: https://developer.apple.com/documentation/xcode/porting_your_macos_apps_to_apple_silicon

Note the diagram which has the words "Any Mac computer".

enter image description here

The Apple Silicon Mac mini is for developers to test that their AS code (and Apple's) runs well. There are no AS Macs available for purchase by non-developers (as of 14th October).

Apple has said that Intel binaries will run on Apple Silicon using Rosetta 2 emulation. So you will have at least the life-span of Big Sur before you need to create a Universal Binary.

I'd say you don't need to worry about this until:

a) AS Macs have been released,
b) people who have bought AS Macs are interested in your tool;
c) Xcode 12 is officially released (along with Big Sur)

at which time, compiling a Universal Binary for a command line tool should be pretty straightforward, just by changing some options.


The process of building a binary for a different architecture than the one you're running is called cross compilation.

As highlighted by the other answers, this is a relatively common occurence, especially in the history of Apple which switched from 68K processors to Power PC, then to Intel, and now to ARM.

Mind you, anyone building an app for iPhone or iPad on their Mac has been cross-compiling, as those already use ARM architecture while their Mac currently uses the Intel architecture. It's even common to build multi-architecture iOS apps, as various CPU versions actually use different variants of the ARM architecture (armv7, armv8...).

Likewise, it's common to build i386 (Intel 32-bit) and amd64/x64 (Intel 64-bit) variants, either independently or as fat/universal binaries.

The process for cross-compiling and building fat/universal binaries depends a lot on the environment and toolchain you use. If you use Xcode, then it's going to be a matter of changing project settings, and voilà!, it's done.

If you are using Unix-type tools (mostly on the command line), including make or variants, gcc or clang, etc, then it may require more or less tinkering of your build process to achieve all that, with quite a few options to change (architecture, but also header files and libraries locations), as well as adding the step which combines the multiple architecture-dependent binaries into a single fat/universal binary.

So it all really depends on your current build process and the tools you use. But it will definitely be possible.

Of course, this is all based on the code to compile actually being portable, i.e. not making assumptions about things (like integer or pointer sizes) and not requiring any assembler code. That used to be a big issue in the past (especially with pure C code), but nowadays with the number of architectures software is currently built for, it's much less common to encounter issues with this.


Is it possible to compile UNIX command line program for Apple Silicon architecture on Intel-based Mac?

Yes, it is.

It's a broad answer and depending on your particular specifics you will need to tweak/adapt your code as necessary.

How do we know this? History is our guide and it's not limited to Apple.

  • OS X was compiled on PowerPC then migrated to Intel
  • OS X was derived from NeXTStep which originally ran on Motorola 6000, then Intel, Sparc, and RISC-PA
  • Open Source operating systems like FreeBSD are (re)compiled for different platforms including i386, AMD64, IA64, Sparc64 and ARM
  • On a personal note, I've compiled XOrg (FreeBSD) to run on an XServe G4.

Switching architectures isn't as daunting as it sounds. Apple will make the tools (XCode) and development hardware available (as you've already mentioned). From a purely business perspective, they have to. Delivering a new OS and literally starting with an App marketplace of virtually zero would be the surest way to kill your product line.

You will have the tools - whether it's from Apple (XCode) or from the Open Source community. The hardware will become more available which will ultimately lower the cost and depending on your market strategy, you may not have to worry about this until a few years after Apple Silicon has been official released due to market adoption rates.