Over 500k applications have been built with Flutter ranging from simple todo apps to management applications since it’s one of the best cross-platform frameworks. This post highlights how you can download and install Flutter on your macOS Device
What is Flutter?
Flutter is an open-source cross-development framework developed and maintained by Google. It was initially launched in 2018 and supported only mobile app development. Today it now supports six platforms: Linux, Android, iOS, web, Windows and macOS.
Flutter Features
Flutter is best known for:
- Cross-platform app development
- Close-to-native performance
- Fast, consistent, and customizable rendering
- Developer-friendly tools
- A rich set of widgets
How to Install Flutter on macOS?
Follow the steps below to to set up a full Flutter installation on your macOs
Prerequisites
To set up and run Flutterin your development environment, it must meet these minimum requirements:
- Operating Systems: macOS, version 10.14 (Mojave) or later.
- Disk Space: 2.8 GB (does not include disk space for IDE/tools).
- Tools: Flutter uses git for installation and upgrade. We recommend installing Xcode, which includes, but you can also install
git
it separately.
Step 1: Download Flutter SDK
Download and install the latest stable Flutter SDK.
Extract Flutter SDK in the desired directory
cd ~/development
unzip ~/Downloads/flutter_macos_3.13.6-stable.zip
Add flutter to your path
export PATH="$PATH:`pwd`/flutter/bin"
This command will only work for the current terminal. To permanently add flutter to your path, use the command below
export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
[PATH_OF_FLUTTER_GIT_DIRECTORY]
correspond to the path you of your flutter SDK.
Refresh the current terminal with the command below:
source $HOME/.<rc file>
Then verify that flutter/bin
is now in your path.
echo $PATH
You can equally verify if the flutter command is available by running the command below
which flutter
From here you will be set to start using Flutter but you need to verify that your installation is healthy
Step 2: Running FLutter Doctor
You just downloaded and set up the path for Flutter, now you need to verify if all the dependencies necessary to run Flutter on your macOS are available. To do so, use the command below:
flutter doctor
The command checks your environment and shows a clear report of your fresh installation like connected devices, presence or absence of Apple Xcode, license and more…
[-] Android toolchain - develop for Android devices
• Android SDK at /Users/dash/Library/Android/sdk
✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ
• Try re-installing or updating your Android SDK,
visit https://docs.flutter.dev/setup/#android-setup for detailed instructions.
✗ Xcode missing
✗CocoaPods not installed
Step 3: Install Xcode
To build Flutter apps for iOS, you need to have Xcode set up in your macOS. You can install it via web download or the Mac App Store
Next, configure the Xcode command-line tool to use the installed version:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
If you wish to use the latest version of Xcode, use the path. However, if it occurs that you need to use a different version, then specify the path to that version
Once this is set, you have to sign the Xcode license agreement. To do so, run the following command:
sudo xcodebuild -license
Please do not use a version older than the stable version to avoid a dysfunctionality. Now you are ready to run your Flutter app either on your simulator or iOS device.
Step4: Setting up iOS Simulator
To run and test your Flutter app on the iOS Simulator, download and install the iOS Simulator by running the command below(for Xcode 15):
xcodebuild -downloadPlatform iOS
If you want to use a different method, check out Apple’s documentation on installing Simulators.
Use the command below to start your simulator:
open -a Simulator
Follow the instructions below to set your simulator to use 64-bit device
- From Xcode, choose a simulator device type. Go to Product > Destination > Choose your target device.
- From the Simulator app, go to File > Open Simulator > Choose your target iOS device
- To check the device version in the Simulator, open the Settings app > General > About.
If the simulated high-screen density iOS devices overflow your screen, then change the presented size in the Simulator app:
- To display the Simulator at a small size, go to Window > Physical Size or
press Cmd + 1. - To display the Simulator at a moderate size, go to Window > Point Accurate or
press Cmd + 2. - To display the Simulator at an HD representation, go to Window > Pixel Accurate or
press Cmd + 3. The Simulator defaults to this size. - The Simulator defaults to Fit Screen. If you need to return to that size, go to Window > Fit Screen or press Cmd + 4.
Now you are set to create your first iOS flutter application and get started with Flutter app development
Related: How to install flutter on Windows
Deploying on a Physical iOS Device
If you want to deploy your app on a physical iPhone or iPad, you need to:
- Create an Apple Developer Account
- Setup physical device deployment on Xcode
- Create a development provisioning profile to self-sign certificates
- Install the third-party CocoaPods dependency manager(For Flutter plugins)
Note that for macOS desktop development, you need to install Xcode and CocoaPods