1、安装Flutter SDK
下载地址:https://flutter.io/sdk-archive/#macos
解压到你电脑某个文件夹下 ,如:
cd ~/development
unzip ~/Downloads/flutter_macos_v0.11.13-beta.zip
2、配置环境变量
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
export PATH=/Users/liangjia/Documents/flutter/bin:$PATH
export ANDROID_HOME=/Users/liangjia/Documents/android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
终端配置方法:
env
//查看环境变量
cd ~ && ls -a && sudo vim .bashrc
//修改环境变量,输入上面的环境变量
//输完后依次按 esc
=> :wq
source ~/.bashrc
//配置生效 //在终端再输入env查看是否成功
flutter doctor
//命令查看是否需要安装其它依赖项来完成安装
3、-bash: fultter: command not found
git clone -b beta https://github.com/flutter/flutter.git
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
为了让配置立即生效,上面的命令输入完成之后,需要在终端输入:
source ~/.bashrc
网友评论