9

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

3 Answers 3

32

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

Sign up to request clarification or add additional context in comments.

Comments

12

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

Comments

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

1 Comment

Thanks man, the link didnt help been on that but knowing it was a .zshrc error helped. got it fixed

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.