Trying to add path to locate flutter to run "flutter doctor" to solve "zsh: command not found: flutter"

Viewed 596

Trying to add path to locate flutter so 'flutter doctor' can be run, to solve zsh: command not found: flutter, then I found that creating below is first step to solution, but again terminal says nano ~/.bash_profile zsh: command not found: nano

then trying to create bash profile also not working, may be it's existing, but somehow it says below. $HOME/.bash_profile zsh: permission denied: /Users/prettygirl/.bash_profile

terminal is given full file access in macOS restarted my macmini vscode quitted and restarted, terminal quitted and restarted

problem still persists. Is there any way to add path variables easily than going through all this hassle with terminal? like macos menu or something to add system path variables?

2 Answers

You're trying to open your bash_profile using nano (text editor) which you don't have installed. You can open that file using any text editor you have. Also, I see you're using zsh and not bash, this means that you should actually edit your ~/.zshrc or ~/.zprofile instead and add

PATH=</path/to/flutter>:$PATH

where you replace </path/to/flutter> with the actual path to flutter on your machine. You can do this if you don't want to add it manually:

echo 'export PATH=</path/to/flutter>:$PATH' >> ~/.zshrc && source ~/.zshrc

again, replacing </path/to/flutter> with your actual flutter path.

This is the only thing that worked for me. Go to where your flutter folder is and right-click, get info, and copy where the path then paste it in the YOUR_PATH part below. Open the .zshrc file using the command: nano ~/.zshrc, Now add the following to the file: export PATH="$PATH:/YOUR_PATH/flutter/bin/" Save the file by pressing Control + X followed by Enter. Apply the changes by command: source ~/.zshrc

Related