Mac 更新系統(tǒng)(10.15.4)以后 cocopod 不好用了 ,連累 Flutter 項目也遇到問題。
運行 flutter docter,提示需要重新安裝 cocopod:
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.4
19E287, locale zh-Hans-CN)
[?] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 11.4)
? 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 3.6)
[?] VS Code (version 1.44.2)
[?] Connected device (2 available)
! Doctor found issues in 1 category.
? flutter git:(stable) ?
按照提示運行 sudo gem install cocoapods,重新安裝 cocopod 成功以后,再次運行 flutter docter:
? flutter git:(stable) ? flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.4 19E287, locale zh-Hans-CN)
[?] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[?] Xcode - develop for iOS and macOS (Xcode 11.4)
[?] Android Studio (version 3.6)
[?] VS Code (version 1.44.2)
[!] Proxy Configuration
! NO_PROXY is not set
[?] Connected device (2 available)
! Doctor found issues in 1 category.
又提示 Proxy 配置問題,[!] Proxy Configuration ! NO_PROXY is not set,搜了一下按照這個 issue:https://github.com/flutter/flutter/issues/41034 增加
export NO_PROXY=localhost,127.0.0.1 這一行到 bash_profile 文件就好了。
我手動添加到 bash_profile 最后一行:

Snip20200426_2.png
保存成功以后再次運行
flutter doctor,問題解決。
? ~ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[?] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.4 19E287, locale zh-Hans-CN)
[?] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[?] Xcode - develop for iOS and macOS (Xcode 11.4)
[?] Android Studio (version 3.6)
[?] VS Code (version 1.44.2)
[?] Proxy Configuration
[?] Connected device (2 available)
? No issues found!