Mac configuration of Flutter environment [zsh: command not found: flutter]

Friends who raise kittens come to my shop! Douyin mall search #早晚早得的猫小店子

First download Flutter from the official website

https://flutter.cn/docs/get-started/install/macos#update-your-path

Pay attention to whether it is an Intel chip or an Apple chip

Unzip the downloaded file and drag it into your /User/computer name directory

Then configure the PATH environment

  • Create a new terminal input

ls -a 
  • Or hit shift + cmd + .

  • Check if there is a .bash_prifile file

  • if not vim

vim ~/.bash_prifile
  • If there is a .bash_prifile file

open -e ~/.bash_prifile
  • enter edit

//添加下面三行,保存
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=/Users/计算机名称/flutter/bin:$PATH  //flutterSDK的路径替换一下
  • Then execute, don't worry about closing bash_profile

source ~/.bash_profile
  • Execute open ~/.zshrc

open ~/.zshrc
  • If there is no zshrc file, execute vim

vim ~/.zshrc
  • If it is not closed, copy it directly. After closing it, open a terminal and open bash_profile

open ~/.bash_profile
  • Copy the contents of bash_profile to zshrc

open -e ~/.zshrc
  • i is the edit mode, press esc after inputting, then input: wq and press enter, then execute source

surce ~/.zshrc
  • After execution, enter flutter -h to check

flutter -h
  • You can also enter flutter doctor

  • If you install the plug-in, add it in the pubspec.yaml file, and VSCode will automatically download the dependent package

If you can't download normally, use the terminal cd to your project

Execute pub get

flutter pub get

Guess you like

Origin blog.csdn.net/zxc8890304/article/details/129658048