Installing Flutter 3.0 on a Mac Mini (2018) running macOS Ventura
Running the flutter 3.0 based 'Hello, world' app on a macOS computer with an Intel processor.
Flutter 3.0 can now create macOS desktop apps which run on Mac computers. This is the hello world example app.
TL:DR— Getting this running took around a dozen commands, and a bit of default question answering and installer clicking for Flutter, Xcode and Android Studio, both of which you have to launch at least once after installation. It took about 15 minutes to set it up. I use a folder called 'Development' in my home directory but you can choose whatever name makes sense for you.
Contents
Xcode
You need to have Xcode and its command line tools installed in order to build macOS or iOS or iPadOS apps. Go ahead and download it from the App Store. run it once, Check Software update after running it and then download the Command line tools from the terminal using xcode-select --install
. To be fair, this takes more than fifteen minutes, so lets not count it in the time to complete as you probably already have it!
Android Studio
Installing Android Studio installs all the Android development tools you need to develop Android apps. It is a requirement now for Flutter according to their documentation page.
- Download Android Studio from the Android Developers website.
- Start Android Studio, and go through the ‘Android Studio Setup Wizard’. This installs the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools, which are required by Flutter when developing for Android. Make sure you have the SDK Command-line tools installed!
- Android Studio
Settings > System Settings > Android SDK
will allow you to check your SDK Platforms, SDK Tools and will display the Android SDK location. You need this path later.
Java
Java hasn't been installed with macOS for a very long time. Java is bundled inside Android Studio which is required to install Flutter now even if you don't wish to use Android Studio as your integrated development environment (IDE). So you have it, albeit hidden away a little and this means that there is no need to install yet another JVM on your Mac, you can let Android Studio manage its updates. Flutter knows about this JVM but if you want to run the command line tools from the Android SDK from terminal rather than from within Android Studio, then you should link the version of Java provided by Google to the place in macOS where it can be recognised by the system. For more information you can review the java_home man page in macOS which explains that the java_home
command returns a path suitable for setting the JAVA_HOME environment variable.
To tell macOS about Android Studio's Java create a symbolic link to it in the right place. (This is for Android Studio, Electric Eel, 2023)
% sudo ln -s /Applications/Android\ Studio.app/Contents/jbr /Library/Java/JavaVirtualMachines/android-studio.jdk
Once you have done this the /usr/libexec/java_home
command in macOS will resolve the location of Java correctly and you can optionally set the JAVA_HOME environment variable in your shell the macOS way using export JAVA_HOME="$(/usr/libexec/java_home)"
.
Flutter
- Get the Flutter SDK making sure you choose the zipfile for Mac computers with Apple silicon! You can ignore the warning about Rosetta unless you need CocoaPods for iOS plugins. You don't need this to compile the demo app for macOS.
- Use terminal to enter the commands to configure your system for flutter and run your first app.
% mkdir Development
% cd Development % unzip ~/Downloads/flutter_macos_3.7.7-stable.zip
% export PATH="$PATH:`pwd`/flutter/bin" % flutter config --no-analytics % flutter doctor - Resolve any issues Flutter Doctor reports.
$ flutter config --android-studio-dir /Applications/Android\ Studio.app % flutter config --android-sdk /replacethiswiththepathtoyour/Library/Android/sdk % flutter doctor --android-licenses % flutter config --enable-macos-desktop % flutter doctor
- Create and run your first app
% cd ~/Projects % flutter create hello_world % cd hello_world/ % flutter run -d macos
- Congratulations! Thats it!
Step by Step instructions to install Flutter 3.0 on a Mac computer with an Intel processor
- Install Xcode, and its command line tools.
- Install Android Studio
- Complete Android Studio first run setup, let it download all the things it needs, check for updates and finish.
- Make flutter part of your environment, by adding the path to your
.zshrc
by adding the line export PATH="$PATH:/pathtowhereflutteris/flutter/bin""You'll need to restart your terminal for this to take effect. - Nobody likes being tracked, least of all by Google. You can turn it off.flutter config --no-analytics
- You'll need to accept the Android licenses to use Android Studio. Type flutter doctor --android-licenses and agree each one. If this command doesn't work, check you have the Android Command-line tools correctly installed.
- Check your config using flutter doctor and fix any resulting issues.
- Navigate to your project folder or any folder you want to create your first app in. cd ~/Projects
- Use the
create
command to instantiate an app based on one of the example templates, type flutter create hello_world - Change into its directory, cd hello_world/
- Run your first macos app created in Flutter flutter run -d macos
- Open your app build folder in Finder, open ~/yourfolder/demo/build/macos/Build/Products/Debug and choose File -> Get Info ( ⌘ I ) on the binary you just created.
- You will see the Application Kind is 'Apple Intel'.
Android Studio
- To build Android apps, be sure to select the Android SDK platforms of interest. Note also that you can see (and copy to the clipboard) the Android SDK location which you need to let Flutter know about.
- Make sure you select Android SDK Command-line Tools - it is not selected by default and Flutter needs it.
Flutter Doctor output
% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.7.7, on macOS 13.2.1 22D68 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 14.2)
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin
usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
! Doctor found issues in 1 category.
Flutter Devices output
I am used to seeing mobile devices here. It really is running macOS as a development target (as well as Chrome!).
% flutter devices
2 connected devices:
macOS (desktop) • macos • darwin-arm64 • macOS 13.2.1 22D68 darwin-x64
Chrome (web) • chrome • web-javascript • Google Chrome 111.0.5563.110
See also
Get the Flutter SDK
Download Android Studio and SDK tools | Android Developers