Mac 安装homebrew
自动脚本(全部国内地址)(在Mac os终端中复制粘贴回车下面这句话)
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Mac 安装fvm
如果配置了国内源
# 添加到 ~/.bashrc 或 ~/.zshrc
echo 'export PUB_HOSTED_URL=https://pub.flutter-io.cn' >> ~/.zshrc
echo 'export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn' >> ~/.zshrc
source ~/.zshrc
还出错
先安装dart
# 1. 安装 dart-sdk
brew install dart-sdk
# 2. 设置永久环境变量
echo 'export PUB_HOSTED_URL=https://pub.flutter-io.cn' >> ~/.zshrc
echo 'export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn' >> ~/.zshrc
echo 'export PATH="$PATH:$HOME/.pub-cache/bin"' >> ~/.zshrc
source ~/.zshrc
# 3. 验证 dart 安装
dart --version
# 4. 使用 dart 安装 fvm
dart pub global activate fvm
# 5. 验证安装
fvm --version
安装flutter
添加到 ~/.zshrc
echo 'export PUB_HOSTED_URL=https://pub.flutter-io.cn' >> ~/.zshrc
echo 'export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn' >> ~/.zshrc
echo 'export GIT_URL=https://gitee.com/mirrors/Flutter.git' >> ~/.zshrc
source ~/.zshrc
fvm install 3.32.4 --verbose
下载完成后
1. 确保全局版本设置正确
fvm global 3.32.4
echo 'export PATH="$PATH:$HOME/fvm/default/bin"' >> ~/.zshrc