系统环境要求
操作系统: macOS (64-bit)
磁盘空间: 至少700M
1、首先下载Flutter SDK https://flutter.dev/docs/get-started/install/macos#get-sdk
将文件提取到所需位置
cd ~/development
$ unzip ~/Downloads/flutter_macos_v1.12.13+hotfix.7-stable.zip
回车执行命令查看当前变量值
echo $PATH
按回车输入密码后用vi打开用户目录下的bash_profile文件。一定要用sudo,否则没权限保存文件,输入密码
sudo vi ~/.bash_profile
将flutter
工具添加到你的路径:(压缩包在上面路径放在上面地方,比如:/Users/wangpei/Desktop/flutter/bin)
export PATH="$PATH:`pwd`/flutter/bin"
再次确认是否添加成功
wangpeideMacBook-Pro:~ wangpei$ echo $PATH
/Users/wangpei/.fastlane/bin:/Users/wangpei/Desktop/flutter/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/wangpei/arcanist/bin/
2、检查开发环境
终端输入命令:flutter doctor
tips:带[✓]代表已经安装好了,[✗]的就必须安装,带[!]的就可以暂时忽略。
[✓] Xcode - develop for iOS and macOS (Xcode 11.1)
[✗] iOS tools - develop for iOS devices
✗ libimobiledevice and ideviceinstaller are not installed. To install with
Brew, run:
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
[!] Android Studio (not installed)
[!] VS Code (version 1.39.2)
✗ Flutter extension not installed; install from
https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[!] Connected device
! No devices available
按照官方文档操作,提示缺少什么内容就安装什么内容,基本不会出错。