I've tried to install flutter multiple times, and could run flutter doctor once, but after closing the terminal I couldn't. Don't know how I did it, and this keeps coming on the screen.
user@users-MacBook-Pro flutter % export PATH="$PATH: /Users/user/Desktop/flutter/bin"
user/users-MacBook-Pro flutter % flutter --version
zsh: command not found: flutter
user@users-MacBook-Pro flutter %
So I have changed my path, changed the shell to -zsh, because I work with macOS Catalina, but nothing seems to work. What should I do?
As Lesiak said, you need to remove the space in your string, leaving you with export PATH="$PATH:/Users/user/Desktop/flutter/bin". However, this will only change the current shell (terminal) you have open.
To make this permanent, you need to change your zsh configuration file. This is located at $HOME/.zshrc. Run this command:
$ echo 'export PATH="$PATH:/$HOME/Desktop/flutter/bin"' >> $HOME/.zshrc
This appends export PATH="$PATH:/$HOME/Desktop/flutter/bin" to the end your .zshrc file. Note that it is crucial that you use >> and not >. >> appends to the file, > overwrites it.
To further explain what's going on here:
$HOME refers to your home directory. On your machine, and if your user is called user, this would be /Users/user. This would vary based on the type of operating system you have and your username, therefore we use $HOME to be device-independent.
$PATH is where your shell looks for programs to execute when you type a command in the shell. If you do echo $PATH you can see its content. It could look something like this: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin. All the parts separated by : is a segment of the path, and your shell looks in each of those directories for a program that matches the command you gave.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With