Add path variable in MacOS for flutter

Flutter commands can be executed from macOS terminal app after adding the path variable to installation of flutter directory on the local machine. You can set Path variable temporarily by executing the following command in the Terminal app or within the Terminal window inside Visual Studio Code

export PATH="$PATH:`pwd`[FLUTTER_INSTALLATION_DIRECTORY]/bin"

where FLUTTER_INSTALLATION_DIRECTORY represents the installtion of flutter SDK on your local macOS

Setting PATH variable permanently

Mac users having Catlina OS and above can follow the below mentioned steps for setting the PATH variable permanently.

  1. Launch Terminal App.
  2. type touch ~/.zshrc and press enter
  3. type vi ~/.zshrc
  4. add export PATH = $PATH[FLUTTER_INSTALLATION_DIRECTORY]/bin
  5. save the changes.
  6. Reload the changes by typing ~/.zshrc

Now you should be able to run all flutter commands using terminal app.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.