Flutter commands do not work in terminal on Mac OS after update

2,251

Solution 1

So I worked this out by manually downloading the flutter SDK then replace it into the original flutter folder. I think it's a problem with the flutter upgrade not being able to completely revert the changes it made after failing to upgrade from the command line.

Solution 2

The way I aliased the flutter command on Mac was by editing my ~/.bash_profile file:

vi ~/.bash_profile
Then add the lines:

alias flutter="/Users/n/development/flutter/bin/flutter" After you save the file (e.g: by typing [esc] :wq in Vim) run the "source" command to load the aliases into your current terminal session:

source ~/.bash_profile

Now the flutter command works in terminal e.g: flutter doctor, flutter test and flutter run

Ref: https://github.com/dwyl/learn-flutter/issues/27#issuecomment-583831888

Share:
2,251
Aamir
Author by

Aamir

Hello. Thanks for visiting.

Updated on December 28, 2022

Comments

  • Aamir
    Aamir over 1 year

    I am running on a Mac, I downloaded Flutter through Git and can confirm that the files are all there, I also successfully updated my path in my ~/.zshrc file. This was all working fine until I ran flutter upgrade, after which the flutter command stopped working. I confirmed this by running which flutter and the output was:

    /Users/aamir/development/flutter/bin/flutter
    

    which looks correct. However, running flutter in my terminal gives me back this error:

    : command not foundpment/flutter/bin/internal/shared.sh: line 5: 
    

    Not sure what's the issue here

  • Aamir
    Aamir about 3 years
    Yup this solves it, need to re-install the SDK manually rather than using git to re-install