There are many tutorials on how to install Flutter on the macOS website, as well as on the website. Here is a summary of the little holes that I hope you will avoid.

Question: The operating system of my computer in the company is 10.14.5 Mojave, while that of my own computer at home is 10.15 Catalina. The same installation steps and environment variable PATH are configured, but the computer at home cannot be used. Dart: command not found: /bin/sh: dart: command not found

Solution: If it is macOS Catalina, you must configure the PATH of flutter and Dart in the.zshrc file. Open the folder containing the decompression of the Flutter SDK using terminal. Then enter vim ~/.zshrc to go to the edit page and add the environment variables for flutter and DART:

  • export PATH=/Users/ALittleNasty/flutterDevelopment/flutter/bin:$PATH
  • export PATH=/Users/ALittleNasty/flutterDevelopment/flutter/bin/cache/dart-sdk/bin:$PATH

After setting the environment variables, press Esc and enter :wq to exit the vim editor. Then run the source ~/. ZSHRC command.

Refer to the link

Install the Flutter SDK process

1. Download the Flutter SDK package

Go directly to the official website to download, I downloaded the latest version 1.17.3.

2. Unzip the SDK

I created a new flutterDevelopment folder under my user and the terminal executed the following command:

cd/ Users/ALittleNasty flutterDevelopment unzip ~ / Downloads/flutter_macos_1. 17.3 - stable. ZipCopy the code

3. Configure environment variables

I extract flutter SDK after the full path: / Users/ALittleNasty/flutterDevelopment/flutter, open a terminal, enter the directory, use vim configuration environment variables, terminal execute the command: vim ~/.bash_profile

# flutter sdk
export PATH=/Users/ALittleNasty/flutterDevelopment/flutter/bin:$PATH
# dart sdk
export PATH=/Users/ALittleNasty/flutterDevelopment/flutter/bin/cache/dart-sdk/bin:$PATH
Copy the code

After the environment variables are configured, the terminal executes the command source ~/.bash_profile to make the configured environment variables take effect, and then executes the flutter -h. The result is successful.

4. Check whether it is successful

Open a terminal and into a file directory, such as/Users/ALittleNasty/Desktop/Movie, then terminal execute the command: Dart –version and dart –version. If command not found is displayed, install the.zshrc environment variable.

ALittleNasty@huyangdeMacBook-Pro Movie % flutter --version flutter 1.17.3 • Channel stable • https://github.com/flutter/flutter.git Framework, revision b041144f83 (6 days line), the 2020-06-04 09:26:11-0700 Engine, Revision EE76268252 Tools • Dart 2.8.4 ALittleNasty@huyangdeMacBook-Pro Movie % Dart --version Dart VM version: 2.8.4 (Stable) (Wed Jun 3 12:26:04 2020 +0200) on"macos_x64"
Copy the code