1.打开bash_profile文件编辑环境变量
open ~/.bash_profile
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/zhangxiaomeng02/Desktop/flutter-1.22.5/bin:$PATH
export ANDROID_HOME="/Users/zhangxiaomeng02/Library/Android/sdk"
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
alias ll='ls -hl'
2.执行环境变量
source ~/.bash_profile
运行 source $HOME/.bash_profile 刷新当前终端窗口.
注意:
如果你使用的是zsh,终端启动时 ~/.bash_profile 将不会被加载,解决办法就是修改 ~/.zshrc ,在其中添加:
source ~/.bash_profile
例子验证:
flutter pub get
网友评论