flutter_macOS环境配置

path环境配置

    1. 执行打开.bash_profile文件的命令:
      1
      open -e .bash_profile
      如果你看到 .bash_profile does not exist.
      执行 touch .bash_profile(创建 bash_profile文件)
    1. 打开.bash_profile文件后直接在最末尾处追加设置flutter bin目录路径为环境变量:
      不用加~
      1
      2
      3
      export PATH=/Users/XXXXX/Applications/soft/flutter/bin:$PATH
      export PUB_HOSTED_URL=https://pub.flutter-io.cn
      export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
      以上三行都加上

tips: 查看flutter安装目录 文件拖入terminal

    1. 保存关闭.bash_profile文件之后,需要执行以下命令,更新环境变量:
      1
      source ~/.bash_profile
      以上命令代表刷新环境变量
    1. 检测
      打开终端执行flutter doctor就发现有效果了.

tips: 注意如果终端使用的是zsh,终端启动时 ~/.bash_profile 将不会被家长,解决办法就是修改 ~/.zshrc,在其中添加: source ~/.bash_profile

第一步 打开zshrc文件

1
open -e .zshrc

第二步 打开文件把source ~/.bash_profile添加到末尾

Powered by Hexo and Hexo-theme-hiker

Copyright © 2013 - 2024 HL's Blog All Rights Reserved.

UV : | PV :