系統環境要求
操作系統: macOS (64-bit)
磁盤空間: 至少3個G
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
按照官方文檔操作,提示缺少什麼內容就安裝什麼內容,基本不會出錯。