CocoaPods is installed but broken. Skipping pod install


Building a Flutter app for iOS it always fails with an error called “CocoaPods is installed but broken. Skipping pod install”

Warning: CocoaPods is installed but broken. Skipping pod install.
[15:23:37]: ▸ You appear to have CocoaPods installed but it is not working.
[15:23:37]: ▸ This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
[15:23:37]: ▸ This can usually be fixed by re-installing CocoaPods.

I tried to reinstall CocoaPods:

    sh("sudo", "gem", "uninstall", "cocoapods")
    sh("sudo", "gem", "install", "cocoapods")
    Dir.chdir "../.." do
      sh("flutter", "packages", "get")
      sh("flutter", "clean")
      sh("flutter", "build", "ipa", "--release", "--obfuscate", "-t", "./lib/main_production.dart", "--split-debug-info=../debugInfo")

But even then the error stays the same…

How did you achieve to use Cocoapods?

I’m using the following orbs:

  flutter-orb: circleci/flutter@1.1.0
  android: circleci/android@2.1.2
  macos: circleci/macos@2.3.1
  ruby: circleci/ruby@1.8.0

Hi, this is probably because you are using sh() to run these commands and this will default to the system Ruby which is not very good for working with gems. Chruby which is set up in the macOS images requires a login bash shell.

Additionally, the Ruby orb mostly works with rvm, which is not installed or really recommended on macOS.

It would be better to move these commands out of this script and move them into a bash script, or a multi line command.

1 Like