cocoapods intallation Errors in mac for flutter doctor

455 Views Asked by At

I install Homebrew. Then I run command "brew install cocoapods". It install successfully but in flutter doctor i got error: cocoapods installed but not working properly. Error because of ruby incompatible version.

Tried another method "sudo gem install cocoapods" and got error:

While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.

This is m1 pro 2020 machine.

3

There are 3 best solutions below

0
On

For MAC M1 chip Users try this solution install ffi first (if not) In regular terminal using command: sudo arch -x86_64 gem install ffi then arch -x86_64 pod install --repo-update Run flutter clean Once complete, rebuild your Flutter application: flutter run

0
On

Try to avoid linking with system ruby and download a new ruby version using brew:

brew install ruby

Then add this line to .bash_profile or .zshrc

export PATH=/usr/local/opt/ruby/bin:$PATH

Close the terminal and open it again, then run this line to make sure the default ruby is the newly installed:

which ruby

Uninstall gem cocoapods and download it using brew

brew install cocoapods
0
On
  • I recently came across the same issue and was able to solve it. Please try the post I created and see if it helps! NOTE: If you are using it for iOS App development you might want to change the version from 1.8.4 to 1.11.0

For many silicon mac users this command might not work. I tried downgrading to this version and it works just fine for me.

WORKS :

sudo gem install -n /usr/local/bin cocoapods -v 1.8.4

Latest CocoaPods 1.10.0 won't work.

Issues with : MacOS 11.0, Ruby 2.6.0.

Errors:

  • sudo gem install -n /usr/local/bin cocoapod

    ERROR:  Could not find a valid gem 'cocoapod' (>= 0) in any repository
    ^[[A^CERROR:  Interrupted
    
  • gem install activesupport -v 6.1.7.3

    Fetching zeitwerk-2.6.8.gem
    Fetching activesupport-6.1.7.3.gem
    ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.