On a macOS High Sierra, I have installed flutter via
git clone https://github.com/flutter/flutter.git
I have add the folder to the path
Configured the system to run all the applications
But I still have the error
flutter command not found
If I try to run it from flutter windows and not from command line, it works fine.
utente-pc:bin itmdev$ ls
cache dart.bat flutter.bat
dart flutter internal
utente-pc:bin itmdev$ flutter
-bash: flutter: command not found
To add entry to macOS PATH variable try this :-
Open Terminal
sudo nano /etc/paths
Paste your flutter path(e.g. /Users/user/Documents/Flutter/flutter/bin)
Save the file and restart the terminal.
I solved this problem by below steps:
Open terminal
Go to your flutter folder
Inside flutter folder run this command pwd
This command will provide you a path. Copy that path
Now run this command export PATH="$PATH:<YOUR COPIED PATH>/bin"
Now run flutter doctor.
Related
I want to install both flutter v1.22.6 and v2.0.5 on my mac.
currently I have v1.22.6 set up on my mac and have path for it set aswell.
I want a setup where if I enter the command flutter doctor that corresponds to v1.22.6 and when I enter the command flutter2 doctor that corresponds to v2.0.5
I am new to the terminal can someone please help? as of now flutter doctor corresponds to v1.22.6 only. I tried setting a path for flutter2 but that shows as no command found
You need to create alias
Navigate to your home directory:
cd ~
Open up .bash_profile using vi:
vi .bash_profile
or
vim .bash_profile
Add an alias (press i):
alias flutter2="~/place_of_folder/flutter2/bin/flutter"
Save the file (press Escape, type :wq, and hit Enter)
Restart Terminal
FVM (Flutter Version Management)
Using the FVM (Flutter Version Management) would be an optimal solution.
Briefly, FVM is an open-source dependency management tool that helps with referencing a certain Flutter SDK version to be used for a certain project, i.e each project can use a different Flutter SDK version.
Installation
Run the following command:
dart pub global activate fvm
Or, using Homebrew:
brew tap leoafarias/fvm
brew install fvm
Usage
Installing the SKDs:
Basically, you install the latest stable Flutter version by running the following command:
fvm install stable
Or, you could specify the version, as:
fvm install [version_number]
For instance, if you want to have the latest version in addition to 3.0.0, you should run the first command and the second command (as fvm install 3.0.0).
Using SDK for a project:
In the terminal, change the directory to your project, and run the following command:
fvm use stable
stable could be replaced with a specified SDK version. At this point, each project will have its own Flutter SDK based on the used fvm use version number.
However, you could also use the same version for all of your projects by running the following command:
fvm global stable
"How to know which version that I'm using for a certain project?"
In the terminal, change the directory to your project, and run the following command:
fvm doctor
Or, since you are able to run the Flutter commands via the used fvm SDK, you could also run
fvm flutter --version
For more information, you could check the FVM documentaion.
Open Terminal & type: echo $SHELL to check what SHELL you're using,
If you use ZSHELL, not BASH, just 1 step to do this task (if BASH, please flow content of #Adelina in this topic):
Open Terminal and type: nano ~/.zshrc
For me, I'm using 2 versions 2.10.5 & 3.7.x, with ver 2.10.5, I don't need to add alias, default is flutter doctor. And with ver 3.7.x, I just add 1 alias "flutter3" like below:
export PATH="$PATH:/Users/macbookpro/development/flutter/bin"
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH="$PATH:/Users/macbookpro/development/flutterV3/bin"
alias flutter3="/Users/macbookpro/development/flutterV3/bin/flutter"
After add 4 lines above with 2 versions Flutter that you have on Mac, press Ctrl + O, tap Enter to save file ZSHELL, and then press Ctrl + X to close file ZSHELL.
Return to Terminal current session, restart Terminal or restart Mac and type flutter3 doctor or flutter doctor to test
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
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.
For zsh:
For zsh (Apple M1):
1.Open Terminal
2.Run: nano ~/.zshrc
3.Add: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH
4.Run: source ~/.zshrc
5.restart terminal
6.Run: flutter doctor -v
I'm using Mac OS BigSur (11.1) and trying to install Flutter. I am running into an issue where it just doesnt seem to load. Has anyone got an idea where I am going wrong? I've followed the instructions on loading and when I try to confirm it I get the following report in Terminal.
The default interactive shell is now zsh.
To update your account to use zsh, please run chsh -s /bin/zsh.
For more details, please visit https://support.apple.com/kb/HT208050.
JonSinclair:~ JonSinclair$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:Users/JonSinclair/Developer/flutter/bin
JonSinclair:~ JonSinclair$ which flutter
JonSinclair:~ JonSinclair$ flutter --version
-bash: flutter: command not found
JonSinclair:~ JonSinclair$
To run flutter command in your terminal, you need to add it to your PATH. PATHs in zsh terminal are reset after you quit terminal. To make permanent changes to your PATH, you need to edit your .zprofile file. Let ~Desktop/Development/flutter be your flutter installation directory.
Step 1 is to open .zprofile file
cd && touch .zprofile && open .zprofile
Now that your .zprofile is open, add this line at the very end of the file
export PATH="$HOME/Desktop/Development/flutter/bin:$PATH";
Save and close the file and run the command
flutter doctor
I'm getting this error message when try to install aqueduct on macOS Catalina with this command.
pub global activate aqueduct
I managed to install it by putting flutter in front of it but now I cannot run aqueduct. I tried
aqueduct --version
I get an error again
zsh: command not found: aqueduct
Here is my .zshrc file (I've added last second line to try to fix it)
export PATH="$PATH:/Users/peter/development/tools/flutter/bin"
export PATH="$PATH":"$HOME/.pub-cache/bin"
I don't know what else to do...
Edit zshrc file using vim on terminal
vim ~/.zshrc
edit data on zshrc after pressing "i" on keyboard.
Export flutter location, aqueduct location and dart sdk location.
NOTE, to change the your_path to your flutter directory. i.e where flutter is installed.
export PATH="$PATH":"your_path/flutter/bin"
export PATH="$PATH":"your_path/flutter/.pub-cache/bin"
export PATH="$PATH":"your_path/flutter/bin/cache/dart-sdk/bin"
After editing press "esc" key and type :wq for saving
Check working of aqueduct using
aqueduct --version
or
aqueduct serve
If you have flutter installed, try flutter pub global activate aqueduct
I got this error zsh: command not found: pub
quick answer if you already have flutter installed
run
flutter pub get
because You can either download the Dart SDK directly (as described below) or download the Flutter SDK, which (as of Flutter 1.21) includes the full Dart SDK.
In my case I wanted to install dependencies in pubspec.yaml in my dart project, but got zsh: command not found: pub.
What is pub
The pub tool has commands for managing packages and for deploying packages and command-line apps.
Well, I don't know what is aqueduct, but this is a common way to solve such issues:
When you see $ zsh: command not found: aqueduct,
run $ which aqueduct - it shouldn't work.
If it works, then the shell does know about a binary named aqueduct.
Find out in which folder aquedict is located, and add the path to it in export PATH=..., like in you did in .zshrc file.
If you found aquedict binary, and it still fails to work, try adding it permissions to execute:
chmod +rwx aquedict
If you didn't found aquedict binary, read the docs again. :)
In your case it's https://aqueduct.io/docs/getting_started/ ,
and the first step is to install Dart: https://dart.dev/get-dart
I'm trying to install React Native on Mac but I'm not able to get past the first step.
npm install -g expo-cli
This seems to work but when I run the next step expo init AwesomeProject I'm getting this error.
-bash: expo: command not found
I also do not have a .npm-global folder. I'm running npm 6.13.4 on Mac OS X 10.15.2.
This might be a local environment issue.
Your computer should know where to look for the commands you're using, it's likely that your mac is not looking for the correct folder.
In order to expo command works, you must have /Users/yourUser/.npm-global/bin in your $PATH commands.
Open your global bash_profile file vim ~/.bash_profile.
add export PATH=$PATH:~/.npm-global/bin.
Save the changes, and right after in your command line:
source ~/.bash_profile
Now you can try the command again!
Important Note: .bash_profile will run only on login shells. For non-login shells, you would need to create or edit .bashrc with this line above.