'Flutter Mac Book M1 You appear to have CocoaPods installed but it is not working

STILL NOT SOLVED

I am setting up Android Studio on Mac Book with M1 Chip (Big Sur).

When editing a project with dependencies, I get a Cocopod error.

I tried reinstalling and reopening Android Studio with:

$ sudo gem install cocoapods

UPDATE

Following the guide: Running CocoaPods on Apple Silicon (M1)

What I did:

  • Right-click on Terminal in Finder
  • Get Info
  • Open with Rosetta
  • sudo arch -x86_64 gem install ffi

Until here no error message

. Then I tried to (In the Project of Android Studio with Rosetta deactivated)

  • Re-install dependencies arch -x86_64 pod install

and got the following error:

Traceback (most recent call last):
        5: from /usr/local/bin/pod:23:in `<main>'
        4: from /usr/local/bin/pod:23:in `load'
        3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/bin/pod:55:in `<top (required)>'
        2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:49:in `run'
        1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:140:in `verify_minimum_git_version!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/command.rb:128:in `git_version': Failed to extract git version from `git --version` ("") (RuntimeError)

My Ruby Version is:

 which ruby

ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]

UPDATE 27.06 I tried it again with a different Ruby Version and it still didn't work:

ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [arm64-darwin20]: Mac M1 - Cocoapods not working (Flutter) verify_minimum_git_version

Location:

ruby -v

/usr/bin/ruby




Content of .zshr file
export PATH="$PATH:/Users/timknogel/tools/flutter/bin"


rvm info

system:

  system:
    uname:        "Darwin Tims-MacBook-Pro.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64"
    name:         "OSX"
    version:      "11.2"
    architecture: "arm64"
    bash:         "/bin/bash => GNU bash, version 3.2.57(1)-release (arm64-apple-darwin20)"
    zsh:          "/bin/zsh => zsh 5.8 (x86_64-apple-darwin20.0)"
    remote_path:  "osx/11.2/arm64"
    xcode:        "12.5"

  rvm:
    version:      "1.29.12 (latest)"
    updated:      "2 days 7 hours 56 minutes 14 seconds ago"
    path:         "/Users/timknogel/.rvm"
    autolibs:     "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."

  homes:
    gem:          "not set"
    ruby:         "not set"

  binaries:
    ruby:         "/usr/bin/ruby"
    irb:          "/usr/bin/irb"
    gem:          "/usr/bin/gem"
    rake:         "/usr/bin/rake"

  environment:
    PATH:         "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/timknogel/tools/flutter/bin:/Users/timknogel/.rvm/bin"
    GEM_HOME:     ""
    GEM_PATH:     ""
    MY_RUBY_HOME: ""
    IRBRC:        ""
    RUBYOPT:      ""
    gemset:       ""

My Git Version is:

% git version git version 2.30.1 (Apple Git-130)

Flutter doctor:

 flutter doctor -v                           
[✓] Flutter (Channel stable, 2.2.1, on macOS 11.2.2 20D80 darwin-arm, locale en-ES)
    • Flutter version 2.2.1 at /Users/timknogel/tools/flutter
    • Framework revision 02c026b03c (7 days ago), 2021-05-27 12:24:44 -0700
    • Engine revision 0fdb562ac8
    • Dart version 2.13.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/timknogel/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.5, Build version 12E262
    ✗ 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.
      To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.

[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Android Studio (version 4.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6916264)

[!] Connected device
    ! No devices available

! Doctor found issues in 3 categories.

ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source