'Ignoring ffi-1.13.1 because its extensions are not built. Try: gem pristine ffi --version 1.13.1

When I installed cocoa pods I got this message. The cocoa pods downloaded is in version 1.10.1. Ive tried to use the command they give but this appears:

Ignoring ffi-1.13.1 because its extensions are not built. Try: gem pristine ffi --version 1.13.1 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

Does it means that the latest version available is 1.13.1 but I can't use it because of a problem? How to solve it?



Solution 1:[1]

Basically, you need to do what the warning message says: install the Gem "ffi" in the specified version by running gem pristine ffi --version 1.13.1. However, usually you don't have write permissions on the system to install a Gem into the stated directory.

You could probably just use sudo, i.e. run the command sudo gem pristine ffi --version 1.13.1 and enter the password, but I guess this is generally not recommended as it is a security risk.

I installed it like this:

gem install ffi --version 1.13.1 --user-install

Then I had to add the installation path to my PATH variable; in my case I added this line to my ~/.zshrc:

export PATH=$HOME/.gem/ruby/2.6.0/bin:$PATH

I'm really not an expert on Ruby stuff, but this solved the issue for me.

Solution 2:[2]

This solved the issue for me

brew install cocoapods

should already be linked (as pointed out by Raphael Pinel) but if you want to make sure run

brew link --overwrite cocoapods

Solution 3:[3]

On Monterey. I did this:

pod install --repo-update
.....Ignoring ffi-1.15.3 because its extensions are not built. Try: gem pristine ffi --version 1.15.3

% brew install cocoapods
% brew link --overwrite cocoapods
% brew outdated
% brew upgrade

But, same problem.

% pod install --repo-update
result... Ignoring ffi-1.15.3 because its extensions are not built. Try: gem pristine ffi --version 1.15.3

I don't have permission to install it in that directory.

Solution 4:[4]

None of the answers worked for me. So, I thought of uninstalling all versions of ruby which I had unknowingly installed, and keeping only the one installed by Xcode.

brew uninstall --force ruby

Then, uninstalled cocoapods

brew uninstall --force cocoapods

I was left with the ruby installed by XCode. I ran:

gem pristine ffi --version 1.15.3

I realised the other versions got installed in ~/.local

I deleted the whole folder as it had nothing other than the old gem folder

rm -rf ~/.local

Now, reinstall cocoapods:

brew install cocoapods

Try running:

pod install

OR

gem -v

You should not see this error.

This usually happens when you have multiple gem versions installed and the path is incorrect.

P.S I am using macOS Monterey 12.1

Solution 5:[5]

in my case ( mbpm1 pro ) , my other project are fine , but some project from my friend ( windows only) i got some issue , i fixed by

  1. arch -x86_64 sudo gem install ffi
  2. flutter clean dont forget to clean after installing some gem
  3. flutter pub get re get
  4. run now ( these run would automatically run pod install ) just click on main.dart ( vscode )

Solution 6:[6]

In my case I had paths mismatch, this command helped me:

rvm get stable --auto-dotfiles

Also check paths order in you .zshrc file

f.e.

# Ruby
export PATH="~/.rvm/gems/ruby-2.6.0/bin:$PATH"
export PATH="/usr/local/opt/ruby/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/ruby/lib"
export CPPFLAGS="-I/usr/local/opt/ruby/include"
export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"

# User local
export PATH="/usr/local/bin:$PATH"

Solution 7:[7]

My issue was that the pre installed ruby had those extensions installed and caused the error messages. Do as follows See all installed messages, should also print the Ignoring ... because its extensions are not built. Directly reference /usr/bin/gem since you might have ruby installed via brew which would be called otherwise.

/usr/bin/gem list

Then manually uninstall all mentioned extensions for the default ruby. Do this for all extensions that cause the message.

sudo /usr/bin/gem uninstall ffi    

Solution 8:[8]

This worked for me :

sudo gem pristine ffi (don't write a version here, because it will fix the problem of all versions)

then,

pod install

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2
Solution 3 Nishant
Solution 4 shet_tayyy
Solution 5 Yogi Arif Widodo
Solution 6 Oleg Kovtun
Solution 7 Deitsch
Solution 8