1. Flutter SDK 下载
2. 解压 SDK 到安装目录
例:安装路径 ~/Desktop/Flutter
cd ~/Desktop/Flutter
unzip ~/Downloads/flutter_macos_1.20.2-stable.zip
3. 环境变量
大家可以将如下环境变量加入到用户环境变量中:
vim $HOME/.bash_profile
保存以下命令,例如: flutter安装路径为 ~/Desktop/Flutter
更多镜像服务器可以参考 Using Flutter in China
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=~/Desktop/Flutter/flutter/bin:$PATH
检查环境变量,运行以下两行命令,检查PATH是否添加成功
source $HOME/.bash_profile
echo $PATH