Flutter command not found

heyred picture heyred · Jun 2, 2018 · Viewed 180.3k times · Source
bash: flutter: command not found

Apparently, none of the flutter commands are working on the terminal of an android studio which I believe I am trying to run it at the root of my project.

Answer

Tree picture Tree · Jun 2, 2018

You need to correctly set up your flutter path.

from here https://flutter.dev/docs/get-started/install/macos#update-your-path

  1. Determine the directory where you placed the Flutter SDK. You will need this in Step 3.
  2. Open (or create) $HOME/.bash_profile. You can do that by using terminal text editor by going in terminal and typing nano ~/.bash_profile

macOS Catalina uses the Z shell by default, so edit $HOME/.zshrc.

If you are using a different shell, the file path and filename will be different on your machine.

  1. Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s git repo:

export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH

for example:

export PATH=~/Documents/flutter/bin:$PATH

  1. press CTRL X and when it asked you to save the file, choose yes

  2. Run source $HOME/.bash_profile to refresh the current window or restart the terminal

  3. Verify that the flutter/bin directory is now in your PATH by running: echo $PATH

Notice that [PATH_TO_FLUTTER_GIT_DIRECTORY] is where you installed flutter SDK, not the location of your app

Instead of nano, you can use any text editor to edit ~/.bash_profile