masOS13.5, xcode14.3.1 Flutter3.10.6
安装软件:xcode/Android Studio/google浏览器
下载flutterSDK,配置环境变量
在终端执行open ~/.bash_profile命令,打开bash_profile文件,如果没有则执行touch ~/.bash_profile进行创建,然后将以下命令添加到bash_profile文件中
export PUB_HOSTED_URL=https://pub.flutter-io.cn//国内用户需要设置
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn//国内用户需要设置
export PATH=`pwd`/flutter/bin:$PATH
注意这里的`pwd`/flutter就是上一步中将sdk拷贝到自己系统的路径
4、添加flutter相关工具到path中,在终端输入命令【open ~/.zshrc】,如果报错【The file /Users/personal/.zshrc does not exist.】,说明还没有创建.zshrc文件,需要先运行【vim ~/.zshrc】创建.zshrc文件,然后再运行【open ~/.zshrc】,具体操作如下所示:
personal@MacBook-Pro ~ % open ~/.zshrc
The file /Users/personal/.zshrc does not exist.
personal@MacBook-Pro ~ % vim ~/.zshrc
personal@MacBook-Pro ~ % open ~/.zshrc
然后将以下配置复制进.zshrc里边
注意: export PATH=【此处为下载的flutter路径】/bin:$PATH
export PATH=/Users/personal/Desktop/project/flutter/bin:$PATH
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
具体显示如下图所示:
截屏2021-11-06 下午3.02.04.png
然后再运行以下命令保存.zshrc文件:
personal@MacBook-Pro ~ % source ~/.zshrc
终端输入 flutter doctor,查看是否有报错,有报错就处理报错
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 (not installed)
安装Android Studio就可以解决
[!] Network resources
✗ An HTTP error occurred while checking "https://github.com/": Operation
timed out
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
设置这两个代理就可以解决
[✗] Android toolchain - develop for Android devices
✗ Unable to locate Android SDK.
Install Android Studio from:
https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK
components.
(or visit https://flutter.dev/docs/get-started/install/macos#android-setup
for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
安装Android Studio后,应用Android SDK就可以解决