Npx cap sync ios ERROR

I have 2 identical projects, in terms of Ionic version, Angular version, and all other NPM packages. With one of the projects, when either attempting to add platform “iOS” or sync it, I get the following error:

:heavy_multiplication_x: Updating iOS native dependencies with pod install - failed!
:heavy_multiplication_x: update ios - failed!
[error] /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21:
warning: Insecure world writable dir /Users/tolga/Code/TOLGA-Git/XENATECH in PATH, mode 040777
Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as
root. (CLAide::Help)

An initial Google search didn’t result in any helpful suggestions. PLease advice, thank you.

Same computer and one project works and the other doesn’t?
That’s weird because the problem seems CocoaPods related, so should’t work on any of them.

How did you install CocoaPods? looks like it’s installed as root.

Or might be related to folder permissions, can you check if they are different in the 2 projects?

maybe one project has older plugins versions and npx cap sync works finr with ruby 2.6, the other project could have other libraries which needs a ruby newer version

it happened to me a lot of times

he needs to upgrade ruby, i guess