bash: flutter: command not found
Hi everyone! Apparently none of the flutter commands are working on the terminal of android studio which I believe I am trying to run it at the root of my project. Thank you in advance
bash: flutter: command not found
Hi everyone! Apparently none of the flutter commands are working on the terminal of android studio which I believe I am trying to run it at the root of my project. Thank you in advance
You need to correctly set up your flutter path.
from here https://flutter.io/setup-macos/#update-your-path
Open (or create) $HOME/.bash_profile
. You can do that by using terminal text editor by going in terminal and typing nano ~/.bash_profile
Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY]
to be the path where you cloned Flutter’s git repo:
export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
for example:
export PATH=~/Documents/flutter/bin:$PATH
press CTRL X
and when it asked you to save the file, choose yes
Run source $HOME/.bash_profile
to refresh the current window or restart the terminal
Verify 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 ~/.bash_profile
Do the following steps:
Download the Flutter SDK Flutter SDK Archive
Extract it where do you want (for example /home/development/flutter
)
Set your PATH, edit your file with this command gedit ~/.profile
, you need to add this line
export PATH=[location_where_you_extracted_flutter]/flutter/bin:$PATH
I showed you above where I've extracted mine, so my export will look like this
export PATH=/home/myUser/development/flutter/bin:$PATH
source ~/.profile
to load the changesflutter doctor
should work!Tried out all the above methods, but all of them lasted only until 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, Tada!
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
You can easily create a symbolic link as below,
sudo ln -s /opt/flutter/bin/flutter /usr/bin/flutter
I had moved flutter into /opt/ folder after downloading, so replace with the path you have flutter directory.
flutter command should work even after rebooting your machine.
Ubuntu 16.04 :-
I added the path correctly for Flutter, Java, Android Studio and Android SDK in .bashrc file , but when I run flutter doctor, the terminal returns
flutter: command not found
Solution :-
So,first I had to always run ->
sudo su
then ->
source /home/your_name/.bashrc
Then run flutter doctor, it works fine.
So everytime, If I want to run flutter doctor, I have to run these above 2 commands.
Hope it helps :)
I faced this problem and I resolved it following these steps:
: nano ~/.bash_profileexport
: add this line: PATH=/Users/user/Documents/flutter_sdk/flutter/bin:$PATH make sure the dir to your flutter bin is correct.
:source ~/.profile
On the mac I followed the steps of the user Tree but still received the answer "flutter: command not found". What I did next was, go to the folder flutter/bin and inside this folder ctrl+click on flutter executable and in the popup i clicked open. After that the mac already recognized this as an exception and the flutter commands already work.
For Ubuntu 14.*
there is no .bash_profile
file but it just a .profile
in /home/mangesh
In my case,I am running this command to add flutter/bin path,
export PATH="$PATH:/home/mangesh/Documents/flutter_data/flutter/bin/"
To verify above change just run,
echo $PATH
Following is my complete output,
mangesh@Mangesh:~$ pwd
/home/mangesh
mangesh@Mangesh:~$ export PATH="$PATH:/home/mangesh/Documents/flutter_data/flutter/bin/"
mangesh@Mangesh:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/mangesh/Documents/flutter_data/flutter/bin/
Add Path in this way in .bashrc
of android sdk and tools with flutter
export PATH=$PATH:/user/Android/Sdk/platform-tools:/user/Android/Sdk/build-tools/27.0.1:/user/Android/Sdk/tools:/user/Android/Sdk/tools/bin:/user/Documents/fluterdev/flutter/bin:$PATH
Then run this command
source ~/.profile
Then you can user any of flutter command like to build fluter apk
flutter build apk