Flutter installation on M1 Mac Monterey 12.6.2
There's a process -
- see https://docs.flutter.dev/get-started/install/macos
- download flutter zip and unzip in ~/code
- add flutter/bin to your .zshrc:
export PATH="$PATH:$HOME/code/flutter/bin"
sudo softwareupdate --install-rosetta --agree-to-license
- run
flutter doctor
- Install XCode from the App Store. You will need an Apple ID. https://apps.apple.com/us/app/xcode/id497799835
- Launch XCode from the Dock and accept the License. Then:
sudo xcode-select --switch /Applications/Xcode.app
sudo xcodebuild -runFirstLaunch
- Install CocoaPods. See https://guides.cocoapods.org/using/getting-started.html#installation
sudo gem install cocoapods
- flutter REQUIRES the
sudo
installation (it couldn't find my --user-install)
- flutter REQUIRES the
- FIX: error installing pod ext/ffi_c
- Install XCode Command Line Tools VERSION 12 - https://developer.apple.com/download/all/?q=xcode
- Newer versions than 12 will FAIL - they're missing ruby/config.h
sudo xcode-select --switch /Library/Developer/CommandLineTools
(make CLI Tools active)- We need to make sure VERSION 12 is the only version found:
cd /Library/Developer/CommandLineTools/SDKs
ls -lF
lrwxr-xr-x 1 root wheel 12 31 Jan 14:49 MacOSX.sdk@ -> MacOSX12.sdk
drwxr-xr-x 7 root wheel 224 31 Jan 14:36 MacOSX12.3.sdk/
lrwxr-xr-x 1 root wheel 14 31 Jan 14:35 MacOSX12.sdk@ -> MacOSX12.3.sdk
- DELETE ANY OTHER VERSIONS (don't skip this)
- Ruby and/or Cocoapods have a magical way of finding the latest version installed, so helpful.
- You might need to DELETE cached files:
rm -rf /Library/Ruby/Gems/2.6.0/gems/ffi-*
rm -rf /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-*
sudo gem install cocoapods
sudo xcode-select --switch /Applications/Xcode.app
(switch back to full XCode)flutter doctor
- Install Android Studio from https://developer.android.com/studio/index.html
- FIX missing
jre
in Android Studio Electric Eelcd /Applications/Android\ Studio.app/Contents
ln -s jbr jre
they renamed the directory and broke flutter
- make a new dummy project in Android Studio
- Open SDK Manager, see https://developer.android.com/studio/intro/update#sdk-manager
- use SDK Manager to download 'Android SDK Command Line Tools' (on the SDK Tools tab)
- tick the box and Apply
flutter doctor --android-licenses
... answer yesflutter doctor
everything should be green!