'Unable to install Pod in Mac M1 pro

I was getting this error when I tried to run pod install

 require': dlopen(/opt/homebrew/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): 
  tried: '/opt/homebrew/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.bundle' 
  (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/ffi_c.bundle' (no such file), 
  '/usr/lib/ffi_c.bundle' (no such file) - /opt/homebrew/lib/ruby/gems/3.1.0/gems/ffi-1.15.5/lib/ffi_c.bundle (LoadError)

This I already did

  1. I have already installed 'ffi gem'
  2. uninstall cocoapods then reinstall via brew
  3. Followed this link too but still not find any help


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source