この場合、IDEの実行ボタンではなくコンソールでflutter run
すると起動できます。
※こんなエラーが出ます
Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
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
CocoaPods not installed or not in valid state.
結論
IDEをコンソールから起動してください。(open /Applications/Android\ Studio.app
)
原因はあまり深く追っていないので正確にはわからないのですが、
GUI経由で起動した場合とTerminal経由で起動した場合でPATHの読み込み結果が変わってしまうらしく、以降名前解決が上手く出来なくなってしまうことに寄るらしいです。
奮闘記録
IDEを変えてみる
IntelliJ IDEA
→ Android Studio
→ VSCode
事象全く変わらず。
XCodeのビルドが通るのか試してみる
通らない。同じエラーが出る。
rbenvではなくシステムのrubyに切り替える
m1 mac
× rbenv
× cocoapods
の組み合わせが悪いらしい。
rbenvをアンインストールしてシステムのrubyに切り替え、homebrewでcocoapodsをインストールし直す。
事象全く変わらず。