title: CocoaPods on M1 (Apple Silicon) fails with ffi wrong architecture
body: <p>Running 'pod install' on a M1 MacBook failed for me due to an ffi issue, as described <a href="https://stackoverflow.com/questions/64901180/running-cocoapods-on-apple-silicon-m1/64901980">here</a>.</p>
  <p>I followed some of the workarounds (I guess I tried all of them in various order), but now I get a slightly different error:</p>
  <pre><code>LoadError - dlopen(/opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
      /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture
      /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture - /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.0/lib/ffi_c.bundle
  </code></pre>
  <p>So, it seems I now have ffi, but with a wrong architecture? How can I fix this? This happens with/without running the terminal in Rosetta mode.</p>
  <p>One of the proposed workarounds did not succeed for me, by the way. When I try:</p>
  <pre><code>sudo arch -x86_64 gem install ffi
  </code></pre>
  <p>I get:</p>
  <pre><code>arch: posix_spawnp: gem: Bad CPU type in executable
  </code></pre>
  <p>Not sure if this is related.</p>