Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Having trouble setting flutter path - flutter commands not found

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.

like image 513
Terry Feng Avatar asked Mar 14 '18 01:03

Terry Feng


2 Answers

I had the same issue when i am working VS Code / flutter with ubuntu OS. every time shows the message flutter: command not found . Then i set the path through VS Code integrated terminal. Please see the below screenshot.

enter image description here

like image 160
Ragesh S Avatar answered Oct 27 '22 06:10

Ragesh S


I'm using macOS Catalina version- 10.15.7 and I have updated my $PATH variable by following those steps:

  1. 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
  2. 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
  3. As i'm using Z shell i have to open the .zshrc file. In my case i'm using vim editor. You can also use nano or atom editor. For opening the file type vi ~/.zshrc in your terminal.
  4. Type i for Insert mode.
  5. Type export PATH="$PATH:[your_flutter_sdk_path_here]/flutter/bin"
  6. To save the file in Vim/vi, press Esc key then type :w and hit Enter key.
  7. To quit Vim/vi by press Esc key then type :x and hit Enter key.
  8. 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

like image 38
Torongo Avatar answered Oct 27 '22 06:10

Torongo