Description
To solve the pod install
issue on the M1 MacBook, #2974 suggests arch -x86_64 pod install
command. You can also find it in a CocoaPods issue.
However, this approach is inappropriate. You may receive the following warnings when you run arch -x86_64 pod install
:
[!] Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).
[!] - Emulated x86_64 is slower than native arm64
[!] - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)
[!] Run "env /usr/bin/arch -arm64 /bin/bash --login" then try again.
This is a Ruby problem built in macOS. The built-in Ruby has been deprecated since Catalina (10.15), so you'll have to find another way.
Solution
brew install cocoapods
internally downloads a Ruby suitable for the M1 MacBook.
The whole method I'd like to suggest is:
brew install cocoapods
pod install
instead of:
sudo gem install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install