Doing your own Ruby installation instead of using the system one is preferred, either with Homebrew or rbenv
. Apple is deprectaing the default system installation of Ruby anyway.
1# install homebrew
2/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
3
4# install ruby with rbenv
5brew install rbenv # ruby-build is included
6rbenv install 3.0.1
7rbenv global 3.0.1 # set system default ruby version
8
9ruby -v
10# ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]
1rbenv install -l # list versions that can be installed
2rbenv versions # list installed ruby versions
3rbenv global 3.0.1 # set system default ruby version
1gem install ffi cocoapods
2rbenv rehash # run a rehash after installing gems (or a new Ruby version) to make sure everything new is on your PATH:
sudo
is not needed for Ruby versions installed with rbenv
ffi
is needed here to get rid of some ffi related LoadErrorrbenv rehash
is important, otherwise the Podfile will keep using the old system installed RubyNow you can go to your iOS project and do pod repo update && pod install
1rm -rf ./Podfile.lock
1sudo rm -rf ~/.cocoapods/repos
2pod repo update
pod install
inside an iOS project with Ruby installed with Homebrew and an old CocoaPods installation. The issue is not with FFI library and the error went away with this fresh install of Ruby and CocoaPodsLoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle - /Library/Ruby/Gems/2.6.0/gems/ffi-1.14.2/lib/ffi_c.bundle