M1 Pods Install Crash

After many hours of searching, I still haven’t found a fix on how to install pods via an M1 Mac. Does anyone know how to resolve this?

I cannot install ffi on an M1 Mac, it crashes:

sudo arch -x86_64 gem install ffi
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/psych.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.bundle (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.rb:13:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.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:117:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:701:in `load_yaml'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/config_file.rb:346:in `load_file'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/config_file.rb:198:in `initialize'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/gem_runner.rb:79:in `new'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/gem_runner.rb:79:in `do_configuration'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/gem_runner.rb:44:in `run'
	from /usr/bin/gem:21:in `<main>'

The steps in this did not work either.

This fails as well:

arch -x86_64 pod install
Analyzing dependencies

[!] Automatically assigning platform `iOS` with version `15.2` on target `Firebase Auth Demo (iOS)` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

[!] Automatically assigning platform `macOS` with version `12.1` on target `Firebase Auth Demo (macOS)` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
<internal:/opt/homebrew/Cellar/ruby/3.0.3/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': dlopen(/opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 0x0009): tried: '/opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.4/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/local/lib/ffi_c.bundle' (no such file), '/usr/lib/ffi_c.bundle' (no such file) - /opt/homebrew/lib/ruby/gems/3.0.0/gems/ffi-1.15.4/lib/ffi_c.bundle (LoadError)

Have you considered using Swift Package Manager to install the frameworks you require? For example, if you need to install Firebase frameworks it’s much easier than messing around getting cocoapods installed on your machine to then add Pods to a project.

Hi @Chris_Parker yes, I have, but I can’t get it to install FirebaseUI for the Databases Module 3 lesson 2. Swift Package Manager works fine for Firebase and Firebase-Auth, but fails on Firebase-UI.

@RedFox1

Andrew,

In my version of that project where you are using the “drop-in” UI, the import statement now is:

import FirebaseEmailAuthUI

whereas before is was FirebaseUI when I first built it.

It looks like Google have not made this sign in framework available via Swift Package Manager as yet so you are stuck with having to use cocoapods. That’s a bit of a hassle since you have not been able to get cocoapods fully installed on your M1 Mac.

Did you check the video that Chris Ching posted in Module 1? The video is titled “Additional Steps for Macs with an M1 Chip” and is related to installing cocoapods.

It’s the 4th video in Module 1 of the SwiftUI Database course.

Hey Chris, I didn’t realize those changes. Thanks for noting that difference with the import statement.

I did not check that video out! Thanks for the reference - I’ll give it a shot. When I started the modules, I didn’t have an M1 Mac, so it wasn’t relevant to me. Now that I do… it’s highly relevant. One of those times where it takes longer to setup an environment versus writing some code.

Right now, I’m uninstalling homebrew to get a clean start, then will check out the video. Thanks so much!

I’ll report back how it goes :slight_smile:

My understanding is that using Homebrew is the best way to install cocoapods on an M1 so I’m a bit surprised that it has not worked.

See this post:

Thanks @Chris_Parker, I’ll give that a shot next. I was following that thread last night with no luck, but fingers-crossed the clean install fixes it.

Otherwise, in the Additional Steps for Macs with an M1 Chip by Chris Ching in the 4th video of Module 1, I followed Chris’s steps about using Rosetta to open Terminal (also, liked your trick about duplicating the Terminal app to make one a Rosetta Terminal), but the first step to install ffi fails with the architecture errors:

sudo gem install ffi
Password:
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.rb:3: warning: It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/usr/lib/psych.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.bundle (LoadError)
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
	from /Library/Ruby/Gems/2.6.0/gems/psych-4.0.3/lib/psych.rb:13:in `<top (required)>'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:65:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/yaml.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:117:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:117:in `require'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:701:in `load_yaml'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/config_file.rb:346:in `load_file'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/config_file.rb:198:in `initialize'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/gem_runner.rb:79:in `new'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/gem_runner.rb:79:in `do_configuration'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/gem_runner.rb:44:in `run'
	from /usr/bin/gem:21:in `<main>'

Finally, that did the trick! I followed exactly as that user did after re-installing homebrew in the M1 terminal. Thanks so much @Chris_Parker, appreciate all your responses, and help with this :slight_smile:

One thing that might have prevented it yesterday was that I could have had a Pods folder with corrupted pods in it yesterday. Or perhaps, I was confusing the arch x86_64 install commands with this pure ARM64 install.

Output:

<user>@<computer> Firebase Auth Demo % ls
Firebase Auth Demo.xcodeproj	README.md
GoogleService-Info.plist	Shared
Podfile				img
Pods				macOS
<user>@<computer> rm -rf Pods 
<user>@<computer> Firebase Auth Demo % ls
Firebase Auth Demo.xcodeproj	Shared
GoogleService-Info.plist	img
Podfile				macOS
README.md
<user>@<computer> Firebase Auth Demo % pod install
Analyzing dependencies
Downloading dependencies
Installing Firebase (8.10.0)
Installing FirebaseAuth (8.10.0)
Installing FirebaseAuthUI (12.0.2)
Installing FirebaseCore (8.10.0)
Installing FirebaseCoreDiagnostics (8.10.0)
Installing FirebaseEmailAuthUI (12.0.0)
Installing FirebaseUI (12.0.2)
Installing GTMSessionFetcher (1.7.0)
Installing GoogleDataTransport (9.1.2)
Installing GoogleUtilities (7.6.0)
Installing PromisesObjC (2.0.0)
Installing nanopb (2.30908.0)
Generating Pods project
Integrating client project

Great news Andrew.