bash: flutter: command not found
Apparently, none of the flutter commands are working on the terminal of an android studio which I believe I am tryi
If you are using zsh, you need to follow below steps in mac.
$HOME
location of your mac..zshrc
filenano ~/.zshrc
into iTerm2 terminal.PATH=$HOME/flutter/bin:$PATH
~/.zshrc
file.If this help please upvote :)
You must have .bash_profile file and define flutter path in .bash_profile file.
First of all, if you do not have or do not know .bash_profile, please look my answer: How do I edit $PATH (.bash_profile) on OSX?
You should add below line(.../flutter_SDK_path/flutter/bin) in your .bash_profile
export PATH=$PATH:/home/username/Documents/flutter_SDK_path/flutter/bin
After these steps, you can write flutter codes such as, flutter doctor
, flutter build ios
, flutter clean
or etc. in terminal of Macbook.
@canerkaseler
After you followed the tutorial, if your mac is not even able to run "flutter doctor", you should reboot your mac. This worked for me.
The flutter installation guide says you add this:
export PATH="$PATH:pwd/flutter/bin"
VSC doesn't support pwd for some reason. The fix:
export PATH="$PATH:~/flutter/bin"
If you are on MAC OS
First find the location of your flutter sdk
Flutter SDK File: Write the below command on your terminal to download the flutter sdk
git clone https://github.com/flutter/flutter.git
For example: the SDK file name is flutter and it is in Downloads
Close and open your terminal again
and enter the following commands in your terminal
cd Downloads #go to Downloads
cd flutter #go to flutter
pwd #/Users/[USERNAME]/downloads/flutter/
whoami #Your [USERNAME]
export PATH="/Users/[USERNAME]/downloads/flutter/bin":$PATH
I hope you will manage on based on the example I have given. Upvote the answer if you find it useful.
As I can't comment, I'm answering:
In your terminal, run:
touch $HOME/.bash_profile
vi $HOME/.bash_profile
Now use I
to insert and paste the following:
export PATH="$PATH:$HOME:/PATH_TO_FLUTTER_GIT_DIRECTORY/flutter/bin"
Use esc and type :wq!
to save the file and exit.
Refresh:
source $HOME/.bash_profile
And verify it's OK by running:
echo $PATH