Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Flutter using Homebrew

I would like to install Flutter on my Apple M1 machine using Homebrew. But I am a bit hesitant because I am not sure if this will provide any benefits or it will create more trouble (e.g. permission issues). An alternative way would to be install Flutter using its installer from its docs.

My question is, is there a recommended way to install Flutter on an Apple M1 macbook? I could not find any docs regarding installing Flutter using Homebrew.

like image 463
ebarooni Avatar asked Jan 21 '26 16:01

ebarooni


2 Answers

Update Feb 2025 – Apple M1/M2/M3/M4

I ended up installing Flutter in with the following steps:

  1. Install Homebrew (if you dont already have)* - install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install fvm using Homebrew - install fvm
brew tap leoafarias/fvm
brew install fvm
  1. Install your wanted flutter version through fvm - fvm documentation
fvm install stable  # Installs latest stable version of flutter
  1. Run fvm doctor to ensure it is installed
  2. Set the default flutter version on your machine:
fvm global stable  # sets your default flutter to the installed stable version
  1. After the previous command you might see in the output to change your flutter path to /Users/<YOUR_USER>/fvm/default/bin. In that case from the root of your user:
nano .zshrc
  1. Then paste the following in your .zshrc file:
export PATH="$PATH:/Users/<YOUR_USER>/fvm/default/bin"
  1. Then save (control + o) then hit enter and then exit (control + x)

  2. Close and reopen your terminal and check the flutter installation with fvm flutter --version

  3. Run fvm flutter doctor to resolve and install any missing components

If fvm flutter doctor had such a warning:

! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.1.5/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/<YOUR_USER>/fvm/versions/stable. Consider adding /Users/<YOUR_USER>/fvm/versions/stable/bin to the front of your path.

You can resolve it by uninstalling dart from brew since flutter sdks are shipped already with dart:

brew uninstall dart
like image 108
ebarooni Avatar answered Jan 23 '26 08:01

ebarooni


@ilpianoforte Does a great job outlining the steps, but I needed to do an additional step for macOS 13.x. So, I thought I would consolidate here.

To install Flutter via Homebrew.

  1. Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install fvm with Homebrew (this manages multiple versions of Flutter)
brew tap leoafarias/fvm
brew install fvm
  1. Install the latest stable version of Flutter
fvm install stable
  1. Set default version of Flutter: (-> $HOME/fvm/default)
fvm global
  1. Append the path to Flutter to PATH by copying the line below into .zshrc (located in the home directory). IMPORTANT: Make sure to replace [USER_HERE] with your user name.
export PATH=$PATH:"$HOME/fvm/default/bin"
  1. Reload .zshrc
source ~/.zshrc
  1. Optional: Test Flutter installation.
flutter doctor
like image 30
Mykel Avatar answered Jan 23 '26 09:01

Mykel



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!