skip to Main Content

I was stuck with cocoapods problem while trying to install Flutter on my computer. Although I was constantly installing it, it was not seen by the flutter doctor. How can I solve this problem?

    blackx@Black-Air ~ % sudo flutter doctor
Password:
   Woah! You appear to be trying to run flutter as root.
   We strongly recommend running the flutter tool without superuser privileges.
  /
📎
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.0.1 20B29 darwin-x64, locale tr-TR)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
    ✗ 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
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.52.1)
[!] Connected device
    ! No devices available

! Doctor found issues in 2 categories.

3

Answers


  1. Had the same problem.

    I just looked up my .bash_history and tried to remember, so I don’t know if all below is relevant or in the right order or complete. So here are more or less random commands which might help you.

    In the flutter/ios folder

    rm Podfile.lock

    pod repo update

    Elsewhere

    sudo chown $(whoami) /usr/local/Homebrew

    sudo brew cleanup -d -v

    gem pristine ffi --version 1.14.2

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

    rvm install ruby

    xcode-select --install

    sudo brew tap --repair

    brew install cocoapods

    brew link cocoapods

    git -C /user/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

    If you do find out how to actually do it, please remember the order of your commands so you can post them here too 🙂

    Login or Signup to reply.
  2. Step 1: sudo chmod -R a+w /Library/Ruby/Gems/2.6.0
    Step 2: gem install activesupport -v 6.1.7.2
    Step 3: sudo gem install cocoapods

    Login or Signup to reply.
  3. This problem most probably occur because your flutter service needs super user privileges. You can fix this using this command:

    sudo chown -R $USER /Users/yourUser/flutter/
    

    Change yourUser with your Macos username and run flutter doctor without sudo.

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