Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-bash: flutter: command not found

Tags:

flutter

I'm installing flutter, have followed all the steps in the documentation and also a online course and have set the Path in my .bash_profile file, however every time I try to run a Flutter command I get the error:

-bash: flutter: command not found

enter image description here

Above screen shot of my .bash_profile file.

Here's what I am trying to run:

Carsons-MBP:~ carsoncarbery$ flutter doctor

-bash: flutter: command not found

Carsons-MBP:~ carsoncarbery$ echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:Users/carsoncarbery/development/tools/flutter/bin

My flutter folder is in this directory:

Users/carsoncarbery/development/tools/
like image 610
Kitcc Avatar asked Nov 21 '18 18:11

Kitcc


People also ask

How do you fix a flutter not recognized?

Go to My Computer Properties > Advance System Setting > Environment Variables. In this way, you can solve 'flutter' is not recognized as an internal or external command error in Windows OS.

How do I start a new Flutter app command?

After the Flutter plugin has been installed, you should find the File > New > New Flutter Project menu. If your Android Studio currently doesn't open any project, there should be Create New Flutter Project option on the welcome popup. Click on it and it will open a new popup.


7 Answers

On Mac OS, insert single quotes OR double quotes around the file path like below. It's better to work like this with file paths in source files:

export PATH="/Users/carsoncarbery/development/tools/flutter/bin":$PATH

or

export PATH='/Users/carsoncarbery/development/tools/flutter/bin':$PATH
like image 159
sparsh Avatar answered Oct 17 '22 03:10

sparsh


export PATH=/Users/carsoncarbery/development/tools/flutter/bin:$PATH
like image 30
Bhargav Sejpal Avatar answered Oct 17 '22 04:10

Bhargav Sejpal


After scrambling a lot over many answers . finally I found out that we need to know which shell we are using.

So as per flutter docs,

If you’re using Bash, edit $HOME/.bash_profile or $HOME/.bashrc. If you’re using Z shell, edit $HOME/.zshrc.

As I was using Bash all I did was

touch .bash_profile

open .bash_profile

add my path in .bash_profile as

export PATH="$PATH:/Users/krtrsda/flutter/bin"

run flutter command & we are good to go..

If you are using Z shell

touch ~/.zshrc

open ~/.zshrc

and then add path same as we did for .bash_profile.

like image 23
jayant rawat Avatar answered Oct 17 '22 04:10

jayant rawat


Thanks to pskink who solved this one for me. It should've been:

/users/

instead of:

users/
like image 31
Kitcc Avatar answered Oct 17 '22 03:10

Kitcc


Removing quotes fixed the problem for me. Running MacOS Catalina 10.15.5

Before:

export PATH="$PATH:/Users/me/Developer/flutter/bin"

After:

export PATH=$PATH:/Users/me/Developer/flutter/bin
like image 39
David Luong Avatar answered Oct 17 '22 03:10

David Luong


On macOS Catalina, open terminal, follow this step:

  1. Create zshrc file: touch ~/.zshrc
  2. Open file zshrc: open ~/.zshrc
  3. Insert this line to file, type: export PATH="/Users/YOUR_NAME/Downloads/flutter/bin:$PATH" Save file and close. (explain: YOUR_NAME -is the name of the user your Mac, Downloads -is a folder I put folder flutter)
like image 27
O Thạnh Ldt Avatar answered Oct 17 '22 02:10

O Thạnh Ldt


Here is the complete solution. First of all create zshrc file, if not create already. and to see this use cmd + shift + .

now you need to set environment path using

  1. open terminal and hit command

  2. vim $HOME/.zshrc

  3. press "I" or "i" key for enabling inster mode.

  4. add the path of your flutter sdk folder

same like the following line

export PATH="$PATH:/Users/mobileprogramming/Development/sdks/flutter/bin"
  1. Press "Esc" then write :wq! in terminal and press enter to exit editing.
  2. Reopen the terminal and check flutter doctor or just flutter
like image 34
Himani Sharma Avatar answered Oct 17 '22 04:10

Himani Sharma