4

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.

ilpianoforte
  • 1,180
  • 1
  • 10
  • 28
  • In the docs(From Flutter) it shows a way to install it which many users used before you. May I ask why its not sufficient for you? – DEFL Jun 28 '22 at 08:04
  • @DEFL Not a particular reason to be honest beside having a preference towards using brew. Mainly i wanted to see if there is preferred installation way for an M1 machine. – ilpianoforte Jun 28 '22 at 08:10
  • 2
    https://fvm.app/ maybe you need this – Airshu Jun 28 '22 at 08:28

2 Answers2

10

I ended up installing Flutter in with the following steps:

  1. Install Homebrew (if you dont already have)* - install Homebrew
  2. Install fvm using Homebrew - install fvm
  3. Install your wanted flutter version through fvm - fvm documentation
  4. Not necessary: Install Sidekick which basically gives you a visualization of your installed versions and flutter projects - install sidekick

Example of using fvm: fvm install {version} - # Installs specific version

ilpianoforte
  • 1,180
  • 1
  • 10
  • 28
  • 1
    Worth noting that when doing an initial Flutter setup in this way, `flutter doctor` will warn that Dart on your path will resolve to the version in `opt/homebrew/Cellar`, which is not inside the current Flutter SDK checkout on your path. – GroovinChip Apr 18 '23 at 14:14
6

@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
Mykel
  • 1,355
  • 15
  • 25
  • 1
    Should the PATH setting here be `/Users/[USER_HERE]/fvm/versions/stable/bin`? I tried the above and got a `no such file or directory`. – Paul Grimes Feb 24 '23 at 21:30
  • @PaulGrimes You replace [USER_HERE] with you user name. For example, it could be /Users/paul/fvm/versions/stable/bin – Mykel Feb 24 '23 at 21:44
  • For me @PaulGrimes their suggestion worked. :) – Veslav May 07 '23 at 22:31