'Setting up Flutter in terminal yields a command not found message

I'm trying to setup Flutter on my Mac but when I use the terminal to check the version I keep getting the message "zsh: command not found: flutter"

The steps that I've done to set it up are:

  1. In a terminal window type vim ./zshrc
  2. Paste the export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin" code (changing the brackets to the actual file path)
  3. :wq!
  4. Testing the version by typing flutter --version

Is there something I'm missing, or something I'm not doing right?



Solution 1:[1]

Your PATH step should likely be:

export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/bin" 

Note that the directory you want to add to your path is bin, not flutter/bin, relative to the Flutter git directory.

The install instructions for macOS and Linux specify the steps as:

$ git clone https://github.com/flutter/flutter.git
$ export PATH="$PATH:`pwd`/flutter/bin"

Note that the git clone step creates a flutter directory within your current directory, so the path to add is flutter/bin relative to pwd (the current directory).

Solution 2:[2]

it can be done with an editor nano or vim which will return a text editor terminal there you can edit path and save,eg

nano .bash_profile

nano .bashrc

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 A.K.J.94