bash: flutter: command not found
Apparently none of the flutter commands are working on the terminal of android studio which I believe I am trying to run it at the root of my project.
You need to correctly set up your flutter path.
- Determine the directory where you placed the Flutter SDK. You will need this in Step 3.
- Open (or create)
$HOME/.bash_profile. You can do that by using terminal text editor by going in terminal and typing
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.
- Add the following line and change
[PATH_TO_FLUTTER_GIT_DIRECTORY]to be the path where you cloned Flutter’s git repo:
CTRL Xand when it asked you to save the file, choose yes
source $HOME/.bash_profileto refresh the current window or restart the terminal
- Verify that the flutter/bin directory is now in your PATH by running:
[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
Tried out all the above methods, but all of them lasted only until the terminal was open. So I went ahead and directly added it to the path file permanently.
sudo nano /etc/paths
add this to the file
Save the file, Tada!
Do the following steps:
- Download the Flutter SDK Flutter SDK Archive
- Extract it where do you want (for example
- Set your PATH, edit your file with this command
gedit ~/.profile, you need to add this line
I showed you above where I’ve extracted mine, so my export will look like this
- Save the file and close it.
source ~/.profileto load the changes
- If you run now
flutter doctorshould work!
If you are using zsh, you need to follow below steps in mac.
- Download latest flutter from the official site.
- Unzip it and move to the
$HOMElocation of your mac.
- Add to path via
nano ~/.zshrcinto iTerm2 terminal.
- Save and close
- re-start iTerm2
- Now you will have flutter available.
One if the Answers above should be able to answer your question.