Ankit Khanna
Ankit Khanna

Reputation: 1029

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

Upvotes: 2

Views: 13671

Answers (4)

Desilio Neto
Desilio Neto

Reputation: 560

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

Upvotes: 0

Ho Seok
Ho Seok

Reputation: 57

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!!!

Upvotes: 4

Stamati M
Stamati M

Reputation: 91

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

Upvotes: 9

Awais
Awais

Reputation: 428

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

Upvotes: 3

Related Questions