Having trouble setting flutter path - flutter commands not found
Solution 1
I'm using Ubuntu 18.04 LTS. Assuming you have successfully downloaded and extracted flutter_linux_v0.5.1-beta.tar.xz (latest update until now) onto your preferred directory.
export PATH=`pwd`/flutter/bin:$PATH
Running this command in your ubuntu terminal (Ctrl + Alt + T) adds flutter commands PATH variable to your system path for temporary session. As soon as you close the terminal, the system path is removed.
In order for ubuntu terminal to remember flutter commands permanently, you need to:
1.) open up terminal and cd to $HOME. for eg: user@linux:~$
2.) open the hidden file
.bashrc
with your desired editor. It resides in $HOME.3.) add the following line
export PATH=/home/yourname/flutter/bin:$PATH
somewhere as a newline in.bashrc
file preferably as a last line edit & save file.4.) run
source /home/yourname/.bashrc
in terminal to process your recent changes.5.) finally, run
echo $PATH
to see flutter dir is in your system path along with other such paths. for eg:/home/yourname/flutter/bin
Now close current terminal and reopen new terminal to check flutter doctor
. It should process along with all other available flutter commands everytime now onwards. Thank you ! :)
Solution 2
Windows
Refer to this tutorial https://www.java.com/en/download/help/path.xml
Mac OS
Open or create one the following files:
-
~/.profile
(Compatible with MacOS Catalina) -
.bash_profile
(Only if your Terminal uses Bash)
export PATH=$PATH:/flutter/bin
Linux
Open or create ~/.bash_profile
add the following line at the bottom.
export PATH=$PATH:/flutter/bin
Linux (Ubuntu 19.04)
Open ~/.bashrc
add the following line at the bottom: (your path may be different)
export PATH=$PATH:~developement/flutter/bin
For further documentation
https://flutter.io/docs/get-started/install/macos#update-your-path
Solution 3
export PATH=`pwd`/flutter/bin:$PATH
Solution 4
open a terminal window and write command vim ~/.bash_profile Write this in the file.
alias flutter="~/flutter/bin/flutter"
if you have extracted flutter in your root (~) folder.
save this and run this command in terminal.
source ~/.bash_profile
Now you are done.
Solution 5
I'm using macOS Catalina version- 10.15.7 and I have updated my $PATH
variable by following those steps:
- Optional: Type
echo $SHELL
in your terminal. It will tell you which shell you are using. macOS Catalina uses Z shell by default. Output: /bin/zsh - Optional: Type
echo $PATH
in your terminal and hit enter. It will show you the existing paths you have already set as path variable. Output: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin - As i'm using Z shell i have to open the
.zshrc
file. In my case i'm usingvim
editor. You can also usenano
oratom
editor. For opening the file typevi ~/.zshrc
in your terminal. - Type
i
for Insert mode. - Type
export PATH="$PATH:[your_flutter_sdk_path_here]/flutter/bin"
- To save the file in Vim/vi, press
Esc
key then type:w
and hitEnter
key. - To quit Vim/vi by press
Esc
key then type:x
and hitEnter
key. - Finally you need a dot notation to activate it. Type
. ~/.zshrc
in your terminal.
Now you can check your path variable by typing echo $PATH
in your terminal and hiting enter
key.
Output: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin:/Users/user/Documents/flutter/bin
Verify that the flutter command is available by running which flutter
in your terminal.
Output: /Users/user/Documents/flutter/bin/flutter
Admin
Updated on May 10, 2021Comments
-
Admin almost 3 years
I've been trying to set a flutter path so I don't need to do a temporary path every single time. I'm new to using terminal and Unix (Mac user also) and don't understand how to set my path with the instructions on the site. And it doesn't help that I'm not completely sure where I out my flutter sdk. Would like to know step by step what to do.
-
Pratik Mohanrao Gondil over 5 years.bashrc files is not found in my case please help ;(
-
sparsh over 5 yearsuser@linux:-$ ls -la | grep -i ".bashrc" (firstly, use this command to verify ".bashrc" do exists or not in you home root dir)
-
Pratik Mohanrao Gondil over 5 yearsit present in the directory but running the .bashrc it gives permission denied. i already pemission read and write on home
-
sparsh over 5 yearsit’s clear then, you need sudo permission to access bashrc file. Alternatively you can also use “.profile” file instead of bashrc which also happens to reside in same Home root dir. :)
-
Pratik Mohanrao Gondil over 5 yearsall set but after run it gives this exception please run 'flutter doctor' for information about installing additional components.
-
TipVisor about 4 yearskasunix@kasunix-Inspiron-N4030:~$ flutter doctor Error: Unable to find git in your PATH.