skip to Main Content

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?

10

Answers


  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.

    Login or Signup to reply.
  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
    
    Login or Signup to reply.
  3. Start the Terminal on a Mac M1 with Rosetta and run

    pod update
    
    Login or Signup to reply.
  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

    Login or Signup to reply.
  5. 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"
    
    Login or Signup to reply.
  6. My issue was that the pre installed ruby had those extensions installed and caused the error messages. Run the command below to
    see all installed packages. Said command should also print the error 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.

    sudo /usr/bin/gem uninstall ffi    
    
    Login or Signup to reply.
  7. 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 )
    Login or Signup to reply.
  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

    Login or Signup to reply.
  9. MacOS: Ventura v13.0

    Updating the Ruby version worked like a charm. Did the following steps.

    $ brew install rbenv
    

    Installed the latest ruby version.

    $ rbenv install 3.1.2
    

    To activate the above version as global default version.

    $rbenv global 3.1.2
    

    To install ffi

    $ sudo gem install ffi --version 1.15.5 --user-install
    
    Login or Signup to reply.
  10. gem install cocoapods

    This is a workaround and not a solution, but for me, after trying all other posted solutions (on Monterey 13.0.1, I traced it back to it seemingly picking the homebrew installed cocoapods picking up the ffi library from ~/.rbenv/shims, with the only timely work around being to install cocoapods via gem, per above.

    All this said, I don’t claim to be well versed in rbenv, or any other dependency manager, for that matter.

    I’d love to know a better answer that didn’t bork the homebrew based installation.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search