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
The best way to setup Flutter on Mac
1. Open a new terminal window
2. Type: git clone https://github.com/flutter/flutter.git -b stable
Wait for the SDK to clone onto your machine
3. Type: export PATH="$PATH:`pwd`/flutter/bin", which adds flutter tool to your path
4. Type: flutter doctor , which downloads additional dependencies
Wait for dependencies to download and install
First, download the Flutter here: https://flutter.dev/docs/get-started/install/macos
When you created the folder with Flutter SDK, open it in Terminal using the following command:
cd ~/development
If there is no development folder run this command first:
mkdir /development
After that, you need to run the unzip command. Make sure you specify the correct path to the downloaded Flutter archive file. Run the command below:
unzip ~/Downloads/flutter_macos_1.17.1-stable.zip
Setting the Flutter tool path
In order to set up the Flutter tool path you should run this command:
export PATH="$PATH:`pwd`/flutter/bin"
Next, you need to know which shell you are using. For this run this command:
echo $SHELL
Depending on the shell run the following command: [Note, the command you will be using depends on the shell you have.]
sudo nano ~/.zshrc
or
sudo nano /.bashrc
After that in the new window, you need to add a path to the flutter tool.
Use the following command:
export PATH=$PATH:~/development/flutter/bin
The next thing you need to do is to check the Flutter dependencies.
For this, run the command:
flutter doctor
This operation will help you to identify if there are any dependencies you need to install. After the results will be prepared click Agree and wait for the installation of the needed dependencies to complete the setup. enter image description here
Previously i was giving my whole path like this:
export PATH=Users/Tekion/Downloads/flutter/bin:$PATH
It started working after i changed my whole path to
export PATH=$HOME/Downloads/flutter/bin:$PATH
Add Path in this way in .bashrc
for Linux and for Mac .bash_profile
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
On Linux
source ~/.profile
On Mac
source ~/.bash_profile
oropen -a TextEdit ~/.bash_profile
Then you can user any of flutter command like to build fluter apk
flutter build apk
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.
if u meet this error in macOS, and install zsh, I am solved in this way