在M系列芯片使用pod install 时提示架构问题,无法成功的 pod install
问题内容如下:
/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/strscan-3.1.0/lib/strscan.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (no such file), '/Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) - /Library/Ruby/Gems/2.6.0/gems/strscan-3.1.0/lib/strscan.bundle (LoadError) from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo/data_sources/posix_time_zone_parser.rb:4:in `<top (required)>' from /Library/Ruby/Gems/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo.rb:48:in `require_relative' from /Library/Ruby/Gems/2.6.0/gems/tzinfo-2.0.6/lib/tzinfo.rb:48:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/values/time_zone.rb:3:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/time_with_zone.rb:4:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/core_ext/time/zones.rb:3:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/core_ext/date/calculations.rb:7:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/core_ext/date.rb:5:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/core_ext.rb:4:in `block in <top (required)>' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/core_ext.rb:3:in `each' from /Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.7.7/lib/active_support/core_ext.rb:3:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods.rb:8:in `<top (required)>' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require' from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/bin/pod:36:in `<top (required)>' from /usr/local/bin/pod:23:in `load' from /usr/local/bin/pod:23:in `<main>'
问题解决的两种方法:
方法二
# 提示ffi 的时候添加 ffi安装 arch -x86_64 gem install ffi # 可以直接执行下述指令 arch -x86_64 pod install # 权限有问题的可以直接加 sudo
注意⚠️:如上述方法都不生效,可以开启和关闭终端的 Rosetta 选项(访达 - 应用程序 - 终端 - 右键 - 显示简介 - 通用 - 使用Rosetta 打开)
文章评论