SkillAgentSearch skills...

Fvm

Flutter Version Manager - POSIX-compliant bash script to manage multiple active flutter versions

Install / Use

/learn @fvm-sh/Fvm
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Flutter Version Manager [fvm version][2]

Inspired by nvm

<!-- To update this table of contents, ensure you have run `npm install` then `npm run doctoc` --> <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Table of Contents

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Intro

fvm allows you to quickly install and use different versions of flutter via the command line.

Example:

$ fvm use 2.10.3
Now using flutter 2.10.3
$ flutter --version
Flutter 2.10.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 7e9793dee1 (9 months ago) • 2022-03-02 11:23:12 -0600
Engine • revision bd539267b4
Tools • Dart 2.16.1 • DevTools 2.9.2
$ fvm install 3.3.8
Now 3.3.8 is installed

Simple as that!

About

fvm is a version manager for flutter. fvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL.

<a id="installation-and-update"></a> <a id="install-script"></a>

Installing and Updating

Install & Update Script

To install or update fvm, you should run the [install script][1]. To do that, you may either download and run the script manually, or use the following cURL or Wget command:

curl -o- https://raw.githubusercontent.com/fvm-sh/fvm/v0.5.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/fvm-sh/fvm/v0.5.1/install.sh | bash

Running either of the above commands downloads a script and runs it. The script clones the fvm repository to ~/.fvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

<a id="profile_snippet"></a>

export FVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.fvm" || printf %s "${XDG_CONFIG_HOME}/fvm")"
[ -s "$FVM_DIR/fvm.sh" ] && \. "$FVM_DIR/fvm.sh" # This loads fvm

Additional Notes

  • If the environment variable $XDG_CONFIG_HOME is present, it will place the fvm files there.</sub>

  • You can add --no-use to the end of the above script (...fvm.sh --no-use) to postpone using fvm until you manually use it.

  • You can customize the install directory, profile using the FVM_DIR, PROFILE. Eg: curl ... | FVM_DIR="path/to/fvm". Ensure that the FVM_DIR does not contain a trailing slash.

  • The installer can use git, curl, or wget to download fvm, whichever is available.

Troubleshooting on Linux

On Linux, after running the install script, if you get fvm: command not found or see no feedback from your terminal after you type command -v fvm, simply close your current terminal, open a new terminal, and try verifying again. Alternatively, you can run the following commands for the different shells on the command line:

bash: source ~/.bashrc

zsh: source ~/.zshrc

ksh: . ~/.profile

These should pick up the fvm command.

Troubleshooting on macOS

Since OS X 10.9, /usr/bin/git has been preset by Xcode command line tools, which means we can't properly detect if Git is installed or not. You need to manually install the Xcode command line tools before running the install script, otherwise, it'll fail.

If you get fvm: command not found after running the install script, one of the following might be the reason:

  • Since macOS 10.15, the default shell is zsh and fvm will look for .zshrc to update, none is installed by default. Create one with touch ~/.zshrc and run the install script again.

  • If you use bash, the previous default shell, your system may not have .bash_profile or .bashrc files where the command is set up. Create one of them with touch ~/.bash_profile or touch ~/.bashrc and run the install script again. Then, run . ~/.bash_profile or . ~/.bashrc to pick up the fvm command.

  • You have previously used bash, but you have zsh installed. You need to manually add these lines to ~/.zshrc and run . ~/.zshrc.

  • You might need to restart your terminal instance or run . ~/.fvm/fvm.sh. Restarting your terminal/opening a new tab/window, or running the source command will load the command and the new configuration.

  • If the above didn't help, you might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.

If the above doesn't fix the problem, you may try the following:

  • If you use bash, it may be that your .bash_profile (or ~/.profile) does not source your ~/.bashrc properly. You could fix this by adding source ~/<your_profile_file> to it or follow the next step below.

  • Try adding the snippet from the install section, that finds the correct fvm directory and loads fvm, to your usual profile (~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc).

Note For Macs with the M1 chip, flutter started offering arm64 arch darwin archive at stable channel since version 3.0.0 and beta channel since 2.12.0-4.1.pre. If you are facing issues installing flutter using fvm, you may want to update to one of those versions or later.

Verify Installation

To verify that fvm has been installed, do:

command -v fvm

which should output fvm if the installation was successful. Please note that which fvm will not work, since fvm is a sourced shell function, not an executable binary.

Note: On Linux, after running the install script, if you get fvm: command not found or see no feedback from your terminal after you type command -v fvm, simply close your current terminal, open a new terminal, and try verifying again.

Important Notes

Note: fvm also support Windows in some cases. It should work through WSL (Windows Subsystem for Linux) depending on the version of WSL. It should also work with GitBash (MSYS) or Cygwin.

Note: On OS X, if you do not have Xcode installed and you do not wish to download the ~4.3GB file, you can install the Command Line Tools. You can check out this blog post on how to just that:

Homebrew installation is not supported. If you have issues with homebrew-installed fvm, please brew uninstall it, and install it using the instructions below, before filing an issue.

Git Install

If you have git installed (requires git v1.7.10+):

  1. clone this repo in the root of your user profile
    • cd ~/ from anywhere then git clone https://github.com/fvm-sh/fvm.git .fvm
  2. cd ~/.fvm and check out the latest version with git checkout v0.5.1
  3. activate fvm by sourcing it from your shell: . ./fvm.sh

Now add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login: (you may have to add to more than one of the above files)

export FVM_DIR="$HOME/.fvm"
[ -s "$FVM_DIR/fvm.sh" ] && \. "$FVM_DIR/fvm.sh"  # This loads fvm
[ -s "$FVM_DIR/bash_completion" ] && \. "$FVM_DIR/bash_completion"  # This loads fvm bash_completion

Manual Install

For a fully manual install, execute the following lines to first clone the fvm repository into $HOME/.fvm, and then load fvm:

export FVM_DIR="$HOME/.fvm" && (
  git clone https://github.com/fvm-sh/fvm.git "$FVM_DIR"
  cd "$FVM_DIR"
  git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$FVM_DIR/fvm.sh"

Now add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login: (you may have to add to more than one of the above files)

export FVM_DIR="$HOME/.fvm"
[ -s "$FVM_DIR/fvm.sh" ] && \. "$FVM_DIR/fvm.sh" # This loads fvm
[ -s "$FVM_DIR/bash_completion" ] && \. "$FVM_DIR/bash_completion"  # This loads fvm bash_completion

Manual Upgrade

For manual upgrade with git (requires git v1.7.10+):

  1. change to the $FVM_DIR
  2. pull down the latest changes
  3. check out the latest version
  4. activate the new version
(
  cd "$FVM_DIR"
  git fetch --tags origin
  git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
) && \. "$FVM_DIR/fvm.sh"

Usage

To install a specific version of flutter:

fvm install 3.3.8 # or 3.0.5, 2.5.3, etc

You can list available versions using ls-remote:

fvm ls-remote

And then in any new shell just use the installed version:

fvm u
View on GitHub
GitHub Stars25
CategoryDevelopment
Updated3mo ago
Forks1

Languages

Shell

Security Score

92/100

Audited on Dec 18, 2025

No findings