1.下载flutter sdk https://flutter.dev/docs/development/tools/sdk/releases?tab=macos
2.配置环境变量
打开.bash_profile文件
open $HOME/.bash_profile
将下面内容配置到.bash_profile文件中
export PUB_HOSTED_URL=https://pub.flutter-io.cn //国内用户需要设置
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn //国内用户需要设置
export PATH=(sdk目录)/flutter/bin:$PATH
执行.bash_profile文件
source $HOME/.bash_profile
3.iOS 设置
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
brew update
brew install --HEAD libimobiledevice
brew install ideviceinstaller ios-deploy cocoapods
pod setup
4.新建flutter项目
sudo flutter create demoName
5.修改flutter sdk权限和项目权限
sudo chmod -R 777 sdk目录
sudo chmod -R 777 项目目录
网友评论