Flutter로 iOS 앱을 빌드하는 도중 다음과 같은 에러가 발생했다.
Warning: CocoaPods is installed but broken. Skipping pod install.
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:
sudo gem install cocoapods
이 오류는 되게 복잡해 보이지만 잘 읽어보면 간단히 해결할 수 있는 오류다.
마지막에 있는 문장을 읽어보면 다음과 같다.
To re-install:
sudo gem install cocoapods
보이는 대로 sudo gem install cocoapods
명령어를 실행해서 cocoapods를 재설치하면 된다.
만약 해당 명령어를 실행했을 때 다음과 같은 오류가 난다면 아래 명령어를 실행하면 된다.
Fetching activesupport-6.1.7.3.gem
Fetching zeitwerk-2.6.8.gem
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory
sudo gem install activesupport -v '6.1.7.3'
sudo gem install zeitwerk -v '2.6.8'
버전이 다를 수 있으니 오류 메시지에 뜬 버전으로 입력하고 처음에 입력했던 Cocoapods 재설치 명령어로 재설치하면 된다.