0

I’m trying to install CocoaPods via Bundler on a MacBook Air M1 and I keep getting this error. I’m using Rosetta Terminal but it doesn’t help.

Command:

bundler exec pod install

Stack:

CocoaPods : 1.10.1  
Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580 [universal.x86_64-darwin20]  
RubyGems : 3.0.3  
Host : macOS 11.4 (20F71)  
Xcode : 12.5.1 (12E507)  
Git : git version 2.30.1 (Apple Git-130)  
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib  

Error

LoadError - dlopen(/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture
    /Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle: mach-o, but wrong architecture - /Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi_c.bundle
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:6:in `rescue in <top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ffi-1.15.0/lib/ffi.rb:3:in `<top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ethon-0.13.0/lib/ethon.rb:3:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/ethon-0.13.0/lib/ethon.rb:3:in `<top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:440:in `require’
/Users/myName/Documents/projectName/bundler/ruby/2.6.0/gems/cocoapods-core-1.10.1/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async’
...
/Library/Ruby/Gems/2.6.0/gems/bundler-2.2.7/exe/bundle:37:in `<top (required)>’
/usr/local/bin/bundle:23:in `load’
/usr/local/bin/bundle:23:in `<main>’
Alexey
  • 3
  • 1
  • 5
  • I don't use `bundler` so i'm not 100% sure, but without it I got a similar message. TL;DR the version of ruby that comes pre-installed is very out of date, updating it via brew fixed it for me. See this answer: https://stackoverflow.com/a/66556339/1185169 – Simon McLoughlin Jul 07 '21 at 15:40
  • @SimonMcLoughlin I tried to follow this answer and upgrade ruby to 3.0.1, but then Bundler returns error `google-api-client-0.38.0 requires ruby ​​version ~> 2.4, which is incompatible with the current version, ruby ​​3.0.1p64` – Alexey Jul 07 '21 at 15:45
  • I don't use or know what bundler is. A quick google says that google-api-client v0.38 is extremely old also. Latest version is 0.53.0. I don't know what part of your setup is using that library, but try updating the versions on that also, or complain on their github. Trying to figure out how to use an older version of ruby is not a path I would recommend following. If bundler is not 100% required, maybe try just installing the latest ruby and using cocoapods without bundler – Simon McLoughlin Jul 07 '21 at 15:51
  • @SimonMcLoughlin I tried to update all libraries and run pod install again and again I get an error from the post, this is something weird – Alexey Jul 08 '21 at 07:53
  • I tired a bunch of different tools and solutions. When I found the link above, I did was uninstall everything (uninstalled ruby tools, uninstalled cocoapods, uninstalled extra versions of ruby). Then I opened a new terminal without rosetta. Install brew, install ruby, install cocoapods (without bundler or any compatibility mode) and just did `pod install` in the directory of the project. No additional tools, setup or compatibility modes – Simon McLoughlin Jul 08 '21 at 10:00

1 Answers1

0

The answer can be found in this post: stackoverflow.com/a/66556339/1185169
In my case, the main problem was the locally installed ruby ​​version v2.7.2. It was necessary to use v2.7.3 or newer

Alexey
  • 3
  • 1
  • 5