CocoaPods Apple Silicon M1 LoadError – incompatible library version gems/ffi-1.15.5

Getting the dreaded LoadError during a pod install is always disheartening, especially during a somewhat transitional time period. Even worse is the case where you get such an error as the outcome of an rbenv install command:

LoadError - incompatible library version - .gem/gems/ffi-1.15.5

I had to resort to using the Homebrew version of ffi:

brew install libffi

After that’s done, make sure to tell your shell to use that version going forward – consider adding these to your .zshrc as well:

export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"

In my case, this allowed me to proceed with rbenv install:

rbenv install 3.0.3
rbenv global 3.0.3
rbenv local 3.0.3

Thanks for reading! Please consider Buying me a Coffee or checking out Colibri!