Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter doctor - CocoaPods installed but not working

using zsh - use to work in bash
brew doctor - Your system is ready to brew.
flutter doctor gives this error

[!] Xcode - develop for iOS and macOS (Xcode 12.2)
    ✗ CocoaPods installed but not working.
        You appear to have CocoaPods installed but it is not working.
        This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
        This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293.
      To re-install CocoaPods, run:
        sudo gem install cocoapods  

sudo gem install cocoapods

Gives this error  
dyld: Library not loaded: /usr/local/opt/gmp4/lib/libgmp.3.5.2.dylib  
  Referenced from: /Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby  
  Reason: image not found  
zsh: abort      sudo gem install cocoapods  

I can't get this error above corrected - any suggestions?

which pod

/Users/puser/.rvm/rubies/ruby-2.5.1/bin/pod

which gem

gem () {
    \typeset result
    (
        \typeset rvmrc
        rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc") 
        if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]]
        then
            rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc") 
        fi
        for rvmrc in "${rvm_rvmrc_files[@]}"
        do
            [[ -s "${rvmrc}" ]] && source "${rvmrc}" || true
        done
        unset rvm_rvmrc_files
        command gem "$@"
    ) || result=$? 
    hash -r
    return ${result:-0}
}

which ruby

/Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby
like image 938
Mathias Avatar asked Dec 18 '20 21:12

Mathias


People also ask

Do I need CocoaPods for flutter?

System requirements Flutter supports iOS 11 and later. Additionally, you will need CocoaPods version 1.10 or later.


3 Answers

Using the suggestion for this post, I was able to get cocoapods reinstalled with the commands below
gem native extension error while installing cocoapods

Open Terminal

curl -L https://get.rvm.io | bash -s stable

Reopen Terminal

rvm install ruby-2.6

rvm use ruby-2.6.5

rvm --default use 2.6.5

Then this installed cocoapods as expected

sudo gem install cocoapods
like image 150
Mathias Avatar answered Oct 17 '22 21:10

Mathias


Use brew and gem

  1. first uninstall by gem

    sudo gem uninstall cocoapods

  2. Install cocoapods by brew

    brew install cocoapods

  3. link using brew

    brew link --overwrite cocoapods

like image 21
Amit Kumar Avatar answered Oct 17 '22 20:10

Amit Kumar


curl -L https://get.rvm.io | bash -s stable
rvm install ruby-2.6
rvm use ruby-2.6.5
rvm --default use 2.6.5
sudo gem update
sudo gem install ffi
brew install libffi
sudo gem install cocoapods
pod setup

this worked for me

like image 2
植植心 Avatar answered Oct 17 '22 19:10

植植心