Equipo: chip MacBook2023 M2Pro
versión cocoapods: 1.9.3
Comandos relacionados para instalar cocoapods en mac
(Mi computadora necesita estar instalada a la versión 1.9.3)
//升级cocoapods至最新版本
$ sudo gem install cocoapods -n /usr/local/bin
//升级cocoapods到指定版本 (我的电脑安装到1.9.3版本)
$ sudo gem install cocoapods -v 1.9.3
//卸载之前的旧版本
$ sudo gem uninstall cocoapods -v1.2.1
2. Una vez completada la instalación, ejecute `pod --version` para comprobar si la instalación se ha realizado correctamente y el resultado es un error:
~ pod --version
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (no such file), '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle (LoadError)
3. A juzgar por el informe de error, se debe incluir la versión arm64 de ffi, así que ejecute el siguiente comando:
$ arch -arm64 sudo gem install ffi