after trying to build ionic project with xcode in my new macos i got an error about cocoapods so I sent this command to install
the main error: ionic skipping pod install because cocoapods is not installed


UPDATE: video below with uZD2EQbBqPg helped overcome the error with the sudo gem install cocoapods command.

VIdeo TItle: How to Fix Cocoapods Install Errors on an Apple Silicon Macs

sudo gem install cocoapods

Thats when I got a bunch of errors. to solve it, i was able to find the solution in the video below with the following command:

xcode-select --install

after i tried to install cocoapods, didn't get the error anymore:

ERROR: Failed to build gem native extension


You have to install development tools first.


current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c

/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20230914-14882-1q1b8.rb extconf.rb

checking for ffi.h... *** extconf.rb failed ***


ERROR:  Error installing cocoapods:

ERROR: Failed to build gem native extension

Additional notes from video below which helped solved the problem from the error i was getting

sudo chown -R $(whoami) /usr/local/{lib/node_modules,bin,share}

$ sudo chown -R $(whoami) /usr/lib/node_modules

$ sudo chown -R $(whoami) ~/.npm ~/.npmrc


Sudo vi ~/.zshrc

Ruby -v 

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

Ruby-install —latest ruby

 -U,--update instead.

>>> Updating ruby versions ...

>>> Installing ruby 3.2.2 into /Users/laptop/.rubies/ruby-3.2.2 ...

>>> Installing dependencies for ruby 3.2.2 ...


sudo vi ~/.bash_profile


source /usr/local/opt/chruby/share/chruby/

source /usr/local/opt/chruby/share/chruby/

chruby ruby-3.2.2




Ruby —version

Restart terminal

Ruby —version

Sudo gem install cocoapods 



Add the following to the ~/.bash_profile or ~/.zshrc file:

  source /usr/local/opt/chruby/share/chruby/


To enable auto-switching of Rubies specified by .ruby-version files,

add the following to ~/.bash_profile or ~/.zshrc:


==> Summary

🍺  /usr/local/Cellar/chruby/0.3.9: 12 files, 51.2KB

==> Running `brew cleanup chruby`...

==> Caveats

==> chruby

Add the following to the ~/.bash_profile or ~/.zshrc file:

  source /usr/local/opt/chruby/share/chruby/