Flutter command not found
I tried out all the methods in previous answers, but all of them lasted only while 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:
/Users/yourUserName/Development/flutter/bin
Save the file by pressing Ctrl + X, Y and then Enter. Close the terminal and reopen it again. Tada!
You need to correctly set up your Flutter path.
From macOS install - Update your 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 typingnano ~/.bash_profile
macOS v10.15 (Catalina) uses the Z shell by default, so edit $file 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 repository is:export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
For example:
export PATH=~/Documents/flutter/bin:$PATH
Press Ctrl + X and when it asks you to save the file, choose Yes
Run
source $HOME/.bash_profile
to refresh the current window or restart the terminalVerify 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 file ~/.bash_profile
.
For zsh:
- Open Terminal
- Run:
nano ~/.zshrc
- Add:
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
- Run:
source ~/.zshrc
- restart terminal
- Run:
flutter doctor -v
For example : if flutter in your machine has been installed under [your_username]/Developer/flutter
export PATH=Developer/flutter/bin:$PATH