Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Got error while trying pod install #10220

Closed
jonahbrandwagt opened this issue Nov 18, 2020 · 54 comments
Closed

Got error while trying pod install #10220

jonahbrandwagt opened this issue Nov 18, 2020 · 54 comments

Comments

@jonahbrandwagt
Copy link

Command

/usr/local/bin/pod install

Report

  • What did you do?
    pod install

  • What did you expect to happen?
    Installing my pod's

  • What happened instead?
    Error. This is on my MacBook Pro with the new M1 processor, maybe it has something to do with that.

Stack

   CocoaPods : 1.10.0
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
    RubyGems : 3.1.4
        Host : macOS 11.0.1 (20B29)
       Xcode : 12.2 (12B45b)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : 

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-trunk       : 1.5.0
cocoapods-try         : 1.2.0

Podfile

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'KikiKickzLab' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for KikiKickzLab
  pod 'SwiftyJSON'

end

Error

LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:6:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi.rb:3:in `<top (required)>'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.12.0/lib/ethon.rb:2:in `<top (required)>'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:74:in `cdn_url?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:36:in `create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `map'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:177:in `sources'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1073:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:1072:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:414:in `analyze'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:239:in `block in resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/user_interface.rb:64:in `section'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:238:in `resolve_dependencies'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/installer.rb:160:in `install!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command/install.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
@dnkoutso
Copy link
Contributor

This looks like an issue with ffi installation in your environment. There are many other issues related to this to look around for information.

At this time, CocoaPods is only a consumer of the ffi gem so there isn't much we can do to fix the specific issue you are getting. What we are trying to do is remove the dependency from ffi in a future release.

@jonahbrandwagt
Copy link
Author

jonahbrandwagt commented Nov 18, 2020

Ok, so until CocoaPods removes the ffi dependency I can't use it?

@dnkoutso
Copy link
Contributor

Or fix the ffi gem installation in your environment.

@jonahbrandwagt
Copy link
Author

Fixed it by running the following command: arch -x86_64 pod install

@mast
Copy link

mast commented Nov 19, 2020

Seeing the same on Mac mini with M1. I guess M1 arch is not supported?

After fresh installation of cocoapods on clean Mac mini:

# file /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64e:Mach-O 64-bit bundle arm64e]
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle (for architecture x86_64):	Mach-O 64-bit bundle x86_64
/Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/lib/ffi_c.bundle (for architecture arm64e):	Mach-O 64-bit bundle arm64e

no version for m1?

# uname -a
Darwin Maxims-Mac-mini.local 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101 arm64

@NSDavidObject
Copy link

+1

@handofthecode
Copy link

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

@fmxfmx
Copy link

fmxfmx commented Nov 20, 2020

try this
https://stackoverflow.com/questions/64901180/running-cocoapods-on-apple-silicon-m1

@onur-eren
Copy link

onur-eren commented Nov 20, 2020

Apple released a solution https://support.apple.com/en-us/HT211861 until the softwares are compatible.

Third party tutorial: https://iphonesoft.fr/2020/11/19/astuces-mac-m1-homebrew-cocoapods-recuperation-windows

Quick walkthrough: https://stackoverflow.com/a/64919058

@kangyeting
Copy link

1.打开终端显示简介
2.勾选以Rosetta方式打开
3. 运行 sudo gem install cocoapods (之前安装过就略过
4. 运行 sudo gem install ffi
5.最后pod install
6.source 'https://github.com/CocoaPods/Specs.git' 有的网络不好需要先移除掉

this is true : https://stackoverflow.com/questions/64901180/running-cocoapods-on-apple-silicon-m1

@Kaspik
Copy link

Kaspik commented Nov 23, 2020

We can definitely update title of this issue as compatibility with M1 chip. Same issues here happening on completely fresh and new MacBook Air with M1.

@Riton2013
Copy link

Guys, do you have any ideas to fix this problem, I am using MacBook air with M1 chip.
I can't use "pod search" or "pod update" command so far.

@Kaspik
Copy link

Kaspik commented Nov 24, 2020

As suggested you need to duplicate terminal, run terminal through rosetta (aka x86) and use it there until CocoaPods add compatibility for ARM.

@Riton2013
Copy link

It seem little different with what I met. I can use "pod install", but not "pod search". I already make terminal run with rosetta, I don't know what happen.

@raygpt
Copy link

raygpt commented Nov 25, 2020

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

This worked for me

@cnknv
Copy link

cnknv commented Nov 30, 2020

Here is the solution:
1- Go to your applications > utilities folder.
2- Right click and click "Get Info" on your terminal app
3- Check "Open Using Rosetta" option
4- Start your terminal app
5- sudo gem install cocoapods
6- sudo gem install ffi
7- pod install

worked on my end

@dnkoutso
Copy link
Contributor

dnkoutso commented Dec 1, 2020

This seems an issue with installing ffi gem on M1. At this time cocoapods depends on ffi gem but we are hoping to remove it in a future version which is the only thing that would circumvent this issue.

In the meantime please seek out alternatives on how to successfully install ffi gem within M1 environment.

@OKNoah
Copy link

OKNoah commented Jan 1, 2021

I see people saying they can do this without Rosetta, but I can't reproduce that. It's very annoying.

@OKNoah
Copy link

OKNoah commented Jan 2, 2021

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

Can you clarify... does this mean you have to exclude arm64 and basically do everything after with x86_64?

@dcx86
Copy link

dcx86 commented Jan 25, 2021

Here is the solution:
1- Go to your applications > utilities folder.
2- Right click and click "Get Info" on your terminal app
3- Check "Open Using Rosetta" option
4- Start your terminal app
5- sudo gem install cocoapods
6- sudo gem install ffi
7- pod install

worked on my end

This is the right approach! I had to do some extra steps:
1- Uninstall cocoapods and ffi to begin with
2- Restart terminal after checking the option "Open Using Rosetta"
3- sudo xcode-select --switch /Applications/Xcode.app
then try -- pod install

@lemanno
Copy link

lemanno commented Feb 20, 2021

sudo arch -x86_64 gem install ffi
Then
arch -x86_64 pod install

This worked for me

Mac Mini M1 - worked too

@AyazAI
Copy link

AyazAI commented Mar 5, 2021

It worked on Mac m1

@OKNoah
Copy link

OKNoah commented Mar 5, 2021

All, it feels like I've gotten 100 emails about this fix/workaround of using arch -x86_64 (or using a Terminal in Rosetta mode). It's been posted a few times here already, and likewise on half a dozen other issues on the subject. It's probably futile to say this, but just keep I mind people are following these issues to wait for other developments.

@weiVSwei
Copy link

weiVSwei commented Mar 10, 2021

以此在终端执行下面代码
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
如果依然有问题执行
arch -x86_64 pod update
我这里使用下面这一行解决的

@KaneCheshire
Copy link

I've just installed Cocoapods on a brand new M1 Mac and pod trunk push gives me this same error. It's December now, and over a year since Apple Silicone has been around. Could something not have been built into Cocoapods by now to at least help people fix it without having to dig around in long issue threads? Or even, just a small note on the install page? There's absolutely nothing about it here: https://guides.cocoapods.org/using/getting-started.html

@johndpope
Copy link

@KaneCheshire - wouldn't a simple
arch -x86_64 pod trunk push
fix this?

@endronk
Copy link

endronk commented Feb 14, 2022

try this https://stackoverflow.com/questions/64901180/running-cocoapods-on-apple-silicon-m1

If you can use Homebrew to manage cocoapods.

Uninstall the local cocoapods gem

sudo gem uninstall cocoapods

Reinstall cocoapods via Homebrew

brew install cocoapods

Awesome. This works for me without the need to use arch command, just use a plain pod install.

@gitrthanki1
Copy link

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

unable to resolve using above command. I'm getting arch: posix_spawnp: gem: Bad CPU type in executable

@gitrthanki1
Copy link

Fixed it by running the following command: arch -x86_64 pod install
this command gives 'arch: posix_spawnp: pod: Bad CPU type in executable' on my macOS

@soheilaGhayour
Copy link

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

unable to resolve using above command. I'm getting arch: posix_spawnp: gem: Bad CPU type in executable

same here

@osamamohammed98
Copy link

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

this work for me

@jaweria-siddiqui-cygnis

arch -x86_64 pod install

work for me. Thank You

@iSimar
Copy link

iSimar commented May 15, 2022

Here is the solution: 1- Go to your applications > utilities folder. 2- Right click and click "Get Info" on your terminal app 3- Check "Open Using Rosetta" option 4- Start your terminal app 5- sudo gem install cocoapods 6- sudo gem install ffi 7- pod install

worked on my end

This worked on M1 pro

@bobokhon7
Copy link

sudo arch -x86_64 gem install ffi

Then

arch -x86_64 pod install

Thanks a lot
You saved my life
I spent f***ng 8 hours for this

@digitaltim-de
Copy link

same error and cant fix it m1pro

@glennposadas
Copy link

Read up, 2022, M1 with Rbenv.

My current Rbenv setup (v3.1.2) works fine in most of the project, but here comes a strange project, cocoapods was acting up only on this project.

  1. After uninstalling all the cocoapods remnants,
  2. Set both local and global of your Rbenv to system.
rbenv local system

and

rbenv global system
  1. Then proceed to your usual M1 pod install, like so:
arch -x86_64 pod install

voila!

@martmalo
Copy link

With Mac M1(2020) I can verify that this stackoverflow fixed the issue.

@umairalirehan
Copy link

umairalirehan commented Nov 2, 2022

run this command in ios folder:

arch -arm64 brew install cocoapods

@okerivy
Copy link

okerivy commented Nov 8, 2022

Flutter

sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc
pod install

@shevakuilin
Copy link

Here is the solution: 1- Go to your applications > utilities folder. 2- Right click and click "Get Info" on your terminal app 3- Check "Open Using Rosetta" option 4- Start your terminal app 5- sudo gem install cocoapods 6- sudo gem install ffi 7- pod install

worked on my end

This worked for me, thx!😘

@reem-alhussain
Copy link

reem-alhussain commented Jun 6, 2023

try to uncomment this line:

# platform :ios, '9.0'

@anuragfexle
Copy link

arch -x86_64 pod install

this works

@Greed1997
This comment was marked as a violation of GitHub Acceptable Use Policies
@NathanielNLA
Copy link

run this command in ios folder:

arch -arm64 brew install cocoapods

Worked for me

@mostafabrazi
Copy link

This worked for me
https://stackoverflow.com/a/66556339/6192834

@KunjKanani
Copy link

I deleted my podfile.lock and ran pod install.

It's work for me. I am using Flutter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests