Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup multiple flutter versions on mac?

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

enter image description here

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

enter image description here

like image 892
Junaid Tariq Avatar asked Jul 10 '26 05:07

Junaid Tariq


1 Answers

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 specific Flutter SDK version for a particular 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

Finally, export the FLUTTER_ROOT path to be the FVM's default version, by adding the following in your .zshrc file (which can be found in your home directory):

export FLUTTER_ROOT=$HOME/fvm/default/bin

To confirm that FVM has been successfully installed, run fvm --version on the terminal to see version of the installed one.

Usage

  • Installing the SKDs:

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 the latest version in addition to 3.0.0, you should run the first and second commands (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 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 do I know which version I use for a certain project?"

In the terminal, change the directory to your project, and run the following command:

fvm doctor

Or, since you can run the Flutter commands via the used FVM SDK, you could also run

fvm flutter --version

For more information about FVM, check the FVM documentaion.

like image 71
Ahmad F Avatar answered Jul 11 '26 19:07

Ahmad F



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!