Error during the Installation of POD

I am using M1 and while following the steps in the course “iOS Databases (SwiftUI)” I get the below erro while running

sudo gem install ffi.


sudo gem install ffi
Password:
ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:715:in verify_gem_home' /Library/Ruby/Site/2.6.0/rubygems/installer.rb:905:in pre_install_checks’
/Library/Ruby/Site/2.6.0/rubygems/installer.rb:303:in install' /Library/Ruby/Site/2.6.0/rubygems/resolver/specification.rb:105:in install’
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:195:in block in install' /Library/Ruby/Site/2.6.0/rubygems/request_set.rb:183:in each’
/Library/Ruby/Site/2.6.0/rubygems/request_set.rb:183:in install' /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:215:in install_gem’
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:231:in block in install_gems' /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:224:in each’
/Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:224:in install_gems' /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:170:in execute’
/Library/Ruby/Site/2.6.0/rubygems/command.rb:328:in invoke_with_build_args' /Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:253:in invoke_command’
/Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:193:in process_args' /Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:151:in run’
/Library/Ruby/Site/2.6.0/rubygems/gem_runner.rb:52:in run' /usr/bin/gem:21:in

As my ruby version was old, i thought updating to 3.2.2 would help.
% ruby --version

ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.x86_64-darwin23]

However, after installing Homebrew, I get the below error.


In file included from file.c:39:

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h:13:10: fatal error: ‘CoreFoundation/CFBase.h’ file not found

#include <CoreFoundation/CFBase.h>

^~~~~~~~~~~~~~~~~~~~~~~~~

/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h:13:10: note: did not find header ‘CFBase.h’ in framework ‘CoreFoundation’ (loaded from ‘/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks’)

1 error generated.

make: *** [file.o] Error 1

!!! Compiling ruby 3.2.2 failed!

Any help is appreciated.

@Ethan_Anish

Hi Ethan,

Welcome to the community.

For the courses that specify using cocoapods to add third party libraries like Firebase, you can add those libraries using Xcode’s built in “Swift Package Manager”.

Here is a video from Chris Ching explaining how to do that.

Hi Chris, Thanks for the quick response on this. I spent many hours to find a fix and good to see that I should have tried other methods.