'Cocoapods Installation fails on MacBook Pro M1 Apple Silicon Mac
I have already tried installing while running terminal on "Rossetta" mode. But even then the installation fails.
Command I used : sudo gem install cocoapods
Also tried installing Homebrew but I get the same error.
The error I'm getting is as below:
ERROR: Loading command: install (LoadError)
dlsym(0x7fbc673521d0, Init_date_core): symbol not found - /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
Solution 1:[1]
I also had the same issue when I installed cocoapods via sudo gem install cocoapods. I am on a MacBook Pro with an Apple Silicon (M1) chip. To fix this, I had to uninstall cocoapods using sudo gem uninstall cocoapods and re-install using this command:
arch -arm64 brew install cocoapods
Solution 2:[2]
I found the solution, man. When I google this question, you should get same answer that just like this:
$ sudo arch -x86_64 gem install ffi
$ arch -x86_64 pod install
but this is wrong!!! check your error log
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:85:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle, 9): no suitable image found. Did find: (LoadError) /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle: mach-o, but wrong architecture /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle
this means you need date for gem. so:
sudo gem install date
and it‘s done!!
you may also see this error:
dlopen(/Library/Ruby/Gems/2.6.0/gems/bigdecimal-3.0.2/lib/bigdecimal.bundle, 9): no suitable image found. Did find: (LoadError)
/Library/Ruby/Gems/2.6.0/gems/bigdecimal-3.0.2/lib/bigdecimal.bundle: mach-o, but wrong architecture
/Library/Ruby/Gems/2.6.0/gems/bigdecimal-3.0.2/lib/bigdecimal.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/bigdecimal-3.0.2/lib/bigdecimal.bundle
so, just:
sudo gem install bigdecimal
and it‘s done!!!
Solution 3:[3]
You can go to this GitHub issue for workarounds. Below command seems to be working for some people on M1 machine for installing Cocoapods.
arch -x86_64 sudo gem install cocoapods
Solution 4:[4]
I struggled some hours with this problem, but I think, I found the solution:
First uninstall cocoapods In the terminal run
sudo gem uninstall cocoapods
Then reinstall cocoapods using the homebrew
brew install cocoapods
Inside ios folder run pod repo update
Go back to the root of project then run
Flutter run
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |
| Solution 2 | Reza Rahemtola |
| Solution 3 | Awais |
| Solution 4 | Desilio do Carmo Lima Neto |
