Step 1:

Flutter requires the rosette must be installed on your machine. Rosetta is a translation library which allows users to run apps that contain X86_64 instructions on Apple silicon Mac.

sudo softwareupdate --install-rosetta --agree-to-license

Step 2:

Cocoa-pods require a terminal using UTF-8 encoding. Sometimes only setting “LANG=en_US.UTF-8” not works. you need to perform the following steps:

  1. Open Terminal
nano ~/.zshrc ("or nano ~/.profile if you don't use zsh")
  1. Apeen the following in the editor:
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
  1. Save the file and quit the terminal.
  2. Open the file again and verify.

Step 3 (Optional)

if you still see an error related to “ffi” then reinstall the gem “ffi” in the system with the following command.

sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc