Select a location locally to create a FLUTTER folder.
Second: there are two main installation methods
First: download it from Github
Making address:
https://github.com/flutter/flutter.gitCopy the code
Second: Directly download the installation package and decompress it
Download link:
https://flutter.dev/docs/development/tools/sdk/releasesCopy the code
Github download steps:
1. Configure environment variables, because foreign servers may need to download resources and configure the image
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
Copy the code
Mainly above two, after the configuration
git clone https://github.com/flutter/flutter.gitCopy the code
Run the clone command to download flutter. The process may be slow. Please be patient.
Once installed, the next step is to configure it
Run:
flutter doctor
Copy the code
The main SDK to remember here is the Flutter SDK and dart SDK
Problem a:
* A problem encountered. Please run ‘CHSH -s /bin/zsh’ is displayed when you open the terminal after MacOS Catalina is updated.
Officially, starting with macOS Catalina, your Mac will use ZSH as the default login Shell and interactive Shell. You can also set ZSH as the default Shell on earlier versions of macOS.
Run CHSH -s /bin/zsh to find that the flutter command cannot be used. This is because the shell execution tool is switched and the solution is very simple
Single-pass solution: This method, which is valid only for the current terminal window, is invalid after closing
source ~/.bash_profile Copy the code
Permanent solution:
Make a copy of.bash_profile, then rename it.zprofile, terminal executionsource ~./zprofile
source ~/.zprofileCopy the code
Problem two:
Bash: flutter: command Not found ZSH: command not found bash: flutter: command not found
ZSH: Command not found: flutter problem
To do this, type vi ~/.bash_profile on the command line and press I to add
#Flutter
export FLUTTER=/Users/aa/flutter/flutter/bin
export PATH=$FLUTTER:$PATH
# the Dart configuration
export DartHome="/Users/aa/flutter/flutter/bin"
export PATH="$DartHome:$PATH"
Copy the code
Run after add
source ~/.bash_profileCopy the code
Then verify that the folder is already in the PATH by running the flutter/bin command:
echo $PATHCopy the code
Note: Most MAC installations now use ZSH, so the file to be modified here is not bash_profile but.bashrc
Hidden files can be found in the root directory. Bashrc
And then the text compiler opens.bashrc, again
#Flutter
export FLUTTER=/Users/aa/flutter/flutter/bin
export PATH=$FLUTTER:$PATH
# the Dart configuration
export DartHome="/Users/aa/flutter/flutter/bin"
export PATH="$DartHome:$PATH"Copy the code
Once you add it, remember command+s to save it
This is how to install the Flutter for the first time. There should be no other problems.