I joined the company two days ago, and the computer configured by the company was the latest MAC Mini with M1 chip and ARM64 architecture. I thought there would be many incompatibilities in the development, but it turned out that pod could not run after installation. After a day of stomping pits, THE POD finally runs smoothly. This is to record. First, use the ARM64 architecture to install pod, which can be installed, but will run with an error because pod is not yet compatible with the ARM64 architecture. Thankfully, Apple has added a compatibility mode to prevent this from happening. First go to the “Terminal” app and right-click the introduction to see this:Check “open with Rosetta”, then open the terminal, you have an x86_64 architecture running environment. This option is available only if the application is compatible with both ARM64 and X86_64. If checked, the application will run in x86_64 architecture. If third-party software is not arm64 compliant, Apple will run it in Rosetta mode by default. See here for detailsIf you need to install Rosetta on your Mac

Apple does not install Rosetta by default. Apple’s instructions tell you to install Rosetta when you start some apps (probably third-party X86_64 architecture apps), but I haven’t been prompted to install Rosetta, so just to be safe, I can use the command line to install Rosetta manually:

softwareupdate --install-rosetta --agree-to-license
Copy the code

If the installation is successful, the following message is displayed:

softwareupdate --install-rosetta --agree-to-license
By using the agreetolicense option, you are agreeing that you have run this tool with the license only option and have read and agreed to the terms.
If you do not agree, press CTRL-C and cancel this process immediately.
Package reference com.apple.pkg.RosettaUpdateAuto is missing installKBytes attribute
Install of Rosetta 2 finished successfully
Copy the code

If you’ve already installed it, or if you’re running it on a MAC with An Intel chip macOS Big Sur or higher, you’ll be prompted:

softwareupdate --install-rosetta --agree-to-license
Installing Rosetta 2 on this system is not supported.
Copy the code

See Installing Rosetta 2 on M1 Apple Silicon Macs here for more details on Installing Rosetta

After opening the terminal in Rosetta mode, install the pod through CocoaPods. Ruby can use the system’s own ruby, but some colleagues reported error using the system’s default Ruby, if there is error, use RVM to install and manage Ruby. A few notes: (1) Install Homebrew first

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Copy the code

Install xcode-select before installing pod. Install Xcode-select after using Rosetta mode

xcode-select --install
Copy the code

(3) After the POD is installed, you have to install this

sudo gem install ffi
Copy the code

At this point, pod should work fine on macs with M1 chips, but you may still get errors during installation, so here are some links I refer to to see if the installation doesn’t go well: github.com/CocoaPods/C… Error [!] when using Cocoapods for POD Install on M1 chip Oh no, an error occurred once again When MAC upgrade to macOS Catalina reinstalled cocoaPods Ruby environment Settings – For MAC Install Ruby using RVM, make failed, resulting in installation failure

Tips: The project running simulator has been failing in the past because it is now arm64 and some third party libraries are not compatible. This can also be done using Rosetta. Check “Open with Rosetta” on both Xcode and Xcode Simulator, restart Xcode and Xcode Simulator, Xcode Clean, and recompile.