title: How to build an Intel binary on an M1 Mac from the command line with the standard Apple version of clang?
body: <p>I'm playing with some C code on my M1 MacBook Air and looking at the assembly produced with various optimization levels.</p>
  <p>I'm building a single C file from the commandline with the most basic command:</p>
  <blockquote>
  <p><code>cc foo.c -o foo</code></p>
  </blockquote>
  <p>What switch do I use to build an Intel binary instead of ARM? Are there different flavours of Intel? 32 vs 64 bit? Maybe even older CPU instruction sets? This is surprisingly hard to Google for, but I'm new to the Apple ecosystem.</p>
  <p>What about fat binaries? How would I build a single binary that contained both Intel and ARM code from the commandline?</p>
  <p>(For the purposes of this question I'm only interested in what I can do on the commandline. If I need to set up XCode projects or environment variables, then I'll accept an answer that just says &quot;You can't do it with just the commandline&quot;.)</p>