0

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.

Muhammad Zain
  • 11
  • 1
  • 2
  • Does this answer your question? [You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user)](https://stackoverflow.com/questions/51126403/you-dont-have-write-permissions-for-the-library-ruby-gems-2-3-0-directory-ma) – WSBT Jan 05 '23 at 04:12

3 Answers3

1

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

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
Omar Alkattan
  • 480
  • 4
  • 10
0
  • 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.
    
vvs
  • 1
  • 1