git clone -b beta https://github.com/flutter/flutter.git
如果你的网络环境不太好,请使用工具科学上网,或者使用码云提供的镜像,将上面的https://github.com/flutter/flutter.git
改为码云的地址:https://gitee.com/mirrors/Flutter
2. 将Flutter代码的bin目录加入到系统环境变量中
在终端中进入用户目录:
cd ~
使用下面的命令打开.bash_profile
文件:
open .bash_profile
如果文件不存在,就使用touch
命令创建文件并打开:
touch .bash_profile
open .bash_profile
打开.bash_profile
文件后,添加如下几行:
export PATH= P A T H : / U s e r s / x x x / f l u t t e r / b i n : {PATH}:/Users/xxx/flutter/bin: PATH