3

I know there are many similar answers to this however I have checked them, watched a video on it and tried countless times. I exported the flutter path to the .bashprofile and it is saved as shown in the screenshot however if I close terminal and try using a flutter command like flutter --version or which flutter or even flutter doctor I get flutter not found or zsh: command not found: flutter

How do I fix this so I can permanently use flutter in any directory or path

terminal Picture

terminal Picture 2

Mobina
  • 6,369
  • 2
  • 25
  • 41
SpacedOutKID
  • 95
  • 1
  • 14

3 Answers3

12

Please follow the steps below:

  1. Open the Terminal.
  2. Type: nano ~/.zshrc
  3. Type: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH

enter image description here

  1. Press control+x to Exit
  2. Type: source ~/.zshrc
  3. Restart the Terminal.
  4. Verify by typing flutter --version

enter image description here

Sweta Jain
  • 3,248
  • 6
  • 30
  • 50
4

Adding FLUTTER PPATH to terminal permanently

Step:1

TYPE: echo $SHELL

  • This will tell which SHELL you are using (bash or Z shell)

Step:2

TYPE: $HOME/.bashrc

  • If it shows file does not exists, then you need to create new zshrc file

(Only if the above error accours) TYPE: touch ~/.zshrc // this will create a new zshrc file

Step 3:

TYPE: open $HOME/.zshrc //to open the zshrc file

  • Add the flutter bin path for setting to the terminal permanently in zshrc file

TYPE: export PATH="$PATH:$HOME/development/flutter/bin"

Step 4:

TYPE: source $HOME/.zshrc //to refresh current terminal window

Now u can run flutter cmds without adding path all times

Navin Kumar
  • 3,393
  • 3
  • 21
  • 46
2

You're adding the path to .bash_profile but the error says zsh: command not found: flutter.

Look closely at the error, your default shell is zsh and not bash. So adding the path to .bash_profile doesn't help since the path is being looked up for in .zshrc instead.

Here's how you can add the path to .zshrc instead: https://stackoverflow.com/a/11530176/5066615

Rohan Taneja
  • 9,687
  • 3
  • 36
  • 48