解决:M系列安装 pod install 时,提示 arm64与x86_64 架构问题

2024年6月28日 580点热度 0人点赞 0条评论

在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>'

 

问题解决的两种方法:

方法一

指定 arm64 pod install

# 在项目中使用下面指令 pod install
arch -arm64 pod install

如下成功 pod install:
M系列安装 pod install 时,提示 arm64与x86_64 架构问题

方法二

# 提示ffi 的时候添加 ffi安装
arch -x86_64 gem install ffi

# 可以直接执行下述指令
arch -x86_64 pod install

# 权限有问题的可以直接加 sudo

 

注意⚠️:如上述方法都不生效,可以开启和关闭终端的  Rosetta 选项(访达 - 应用程序 - 终端 - 右键 - 显示简介 - 通用 - 使用Rosetta 打开)

帮助教程

提供最新的帮助教程,方便使用。

文章评论