If the other solution (sudo arch -x86_64 gem install ffi) does not work for you, try the following one instead:
gem install --user-install ffi -- --enable-libffi-alloc
After that, run pod install or whatever you were trying to do again, but without prefixing it with arch -x86_64.
It worked for me without issues and this way I could also avoid going the Intel emulation (Rosetta 2) way.
I find this solution in an issue filed on the ffi github project.