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
Related
I've just switched to MacOs - never used it before and I'm using Macbook M1 Pro, so a newbie here. Also, I've only started with web dev so I'm fairly new in this field as well.
Now, how should I proceed in order to set-up a local development enviroment - I plan to use mainly Laravel & VueJs?
Things I've done so far:
Installed VS code
Installe MAMP
Cloned my Git repository with project I was working on (Windows 10)
This is the part where I need help - I think I'm supposed to install Homebrew, but even if I follow the instructions on their website I can't get it working properly. It's installed but as soon as I close & reopen the terminal, it throws zsh: command not found: brew. The commands I'm used to - php artisan xyz or npm run watch don't work
Do you guys have some guide or step-by-step tutorial of what should I do in order to get my Laravel&Vue git project up & running on a localhost?
brew is installed in /usr/local/Homebrew/bin/brew (symlinked to /usr/local/bin/brew). Make sure /usr/local/bin is in your PATH, so that brew and newly installed Homebrew packages are available on the command line. This is typically setup by the ~/.zshrc file.
Troubleshooting steps:
Edit $HOME/.zshrc.
If export PATH is not found, add the following line. The important part is to ensure /usr/local/bin is present (and that :$PATH is last) to give it higher precedence. If the export PATH line exists, but commented, uncomment it.
export PATH=$HOME/bin:/usr/local/bin:$PATH
Restart your shell. .zshrc is loaded automatically at shell startup.
Check for brew with the which command:
$ which brew
/usr/local/bin/brew
Update
This suggestion here fixed my issues: https://stackoverflow.com/a/66521797/9682588
So, what I did was:
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile
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
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.
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 am installing .net core on a mac and hoping to play around with it a bit on vs code. I am following the steps from
https://www.microsoft.com/net/core#macosx.
However, when I run
dotnet new
I get command not found on bash.
I have followed these previous steps
brew update
brew install openssl
brew link --force openssl
I have also downloaded the core package (installed successfully). I do not see any other steps. Wondering if I am missing a step or how to identify what is missing?
Sometimes I am not sure why the installer doesn't add the PATH to your environment.
Run below in terminal and reopen the terminal:
echo 'export PATH="$PATH:/usr/local/share/dotnet"' >> ~/.bashrc
(Note: If you are using zsh or other shells, please change the above ~/.bashrc to the initialize script of your shell, e.g. ~/.zshrc)
I ran into this same problem earlier today. The fix for me was to close out all Terminal windows, open a new one, then re-run the command.