下载flutter SDK
1.去flutter官网下载其最新可用的安装包
2.解压安装包到你想安装的目录,如:
cd ~/development
unzip ~/Downloads/flutter_macos_v0.5.1-beta.zip
3.添加flutter相关工具到path中:
export PATH=`pwd`/flutter/bin:$PATH
Mac系统下的环境变量:
文件 | 作用 |
---|---|
/etc/profile | 系统级别,系统启动加载 |
/etc/paths | 系统级别,系统启动加载 |
~/.bash_profile | 用户级别,优先读取(建议配置) |
~/.zshrc | zsh 用户,效果等同于 bash_profile |
~/.bash_login | 用户级别,次优先读取(有profile则不读取) |
~/.profile | 用户级别,次次优先读取(有profile/login则不读取) |
~/.bashrc | bash shell打开的时候载入 |
测试flutter
flutter --version --verbose
[ +10 ms] executing: [/Users/xxx/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%H
[ +34 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%H
[ ] 8af6b2f038c1172e61d418869363a28dffec3cb4
[ ] executing: [/Users/xxx/flutter/] git tag --contains HEAD
[ +165 ms] Exit code 0 from: git tag --contains HEAD
[ +2 ms] 1.17.5
[ +6 ms] executing: [/Users/xxx/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[ +8 ms] Exit code 128 from: git rev-parse --abbrev-ref --symbolic @{u}
[ ] fatal: HEAD does not point to a branch
[ +10 ms] Unable to locate an Android SDK.
[ +21 ms] executing: [/Users/xxx/flutter/] git rev-parse --abbrev-ref HEAD
[ +9 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] HEAD
[ +1 ms] executing: [/Users/xxx/flutter/] git rev-parse --abbrev-ref HEAD
[ +8 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[ ] HEAD
[ ] executing: [/Users/xxx/flutter/] git fetch https://github.com/flutter/flutter.git --tags
[+187014 ms] Exit code 0 from: git fetch https://github.com/flutter/flutter.git --tags
[ ] From https://github.com/flutter/flutter
* branch HEAD -> FETCH_HEAD
[ ] executing: [/Users/xxx/flutter/] git tag --contains HEAD
[ +166 ms] Exit code 0 from: git tag --contains HEAD
[ ] 1.17.5
[ ] executing: [/Users/xxx/flutter/] git -c log.showSignature=false log -n 1 --pretty=format:%ar
[ +9 ms] Exit code 0 from: git -c log.showSignature=false log -n 1 --pretty=format:%ar
[ ] 5 months ago
[ +14 ms] Flutter 1.17.5 • channel unknown • unknown source
Framework • revision 8af6b2f038 (5 months ago) • 2020-06-30 12:53:55 -0700
Engine • revision ee76268252
Tools • Dart 2.8.4
注意选择对应的channel 和 version
环境配置问题,都能通过百度,谷歌解决
ruby
cocoapods
rvm
....
网友评论