macOS install
System requirements
To install and run Flutter, your development environment 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 includesgit
, but you can also installgit
separately.
Get the Flutter SDK
-
Download the following installation bundle to get the latest stable release of the Flutter SDK:
Intel Apple Silicon (loading…) (loading…)
For other release channels, and older builds, check out the SDK archive. -
Extract the file in the desired location. For example:
$ cd ~/development $ unzip ~/Downloads/flutter_macos_vX.X.X-stable.zip
-
Add the
flutter
tool to your path:$ export PATH="$PATH:`pwd`/flutter/bin"
This command sets your
PATH
variable for the current terminal window only. To permanently add Flutter to your path, check out Update your path.
You are now ready to run Flutter commands!
Run flutter doctor
Run the following command to see if there are any
dependencies you need to install to complete the setup
(for verbose output, add the -v
flag):
$ flutter doctor
This command checks your environment and displays a report to the terminal window. The Dart SDK is bundled with Flutter; it isn’t necessary to install Dart separately. Check the output carefully for other software you might need to install or further tasks to perform (shown in bold text).
For example:
[-] 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.
The following sections describe how to perform these tasks and finish the setup process.
Once you have installed any missing dependencies,
run the flutter doctor
command again
to verify that you’ve set everything up correctly.
Downloading straight from GitHub instead of using an archive
This is only suggested for advanced use cases.
You can also use git directly instead of downloading the prepared archive. For example, to download the stable branch:
$ git clone https://github.com/flutter/flutter.git -b stable
Update your path, and run flutter doctor
.
This lets you know if there are other dependencies
you need to install to use Flutter (such as the Android SDK).
If you didn’t use the archive, Flutter downloads necessary development binaries as they are needed (if you used the archive, they are included in the download). You might want to pre-download these development binaries (for example, you might do this when setting up hermetic build environments, or if you only have intermittent network availability). To do so, run the following command:
$ flutter precache
For additional download options, check out flutter help precache
.
Update your path
You can update your PATH variable for the current session at
the command line, as shown in step 3 of Get the Flutter SDK.
To update this variable permanently so you can run
flutter
commands in any terminal session,
use the following instructions.
The steps for modifying the PATH
variable
all subsequent terminal sessions are machine-specific.
Typically, you add a line to a shell script file that
executes whenever you open a new window. For example:
- Determine the path of your clone of the Flutter SDK. You need this in Step 3.
- Open (or create) the
rc
file for your shell. Typingecho $SHELL
in your Terminal tells you which shell you’re using. If you’re using Bash, edit$HOME/.bash_profile
or$HOME/.bashrc
. If you’re using Z shell, edit$HOME/.zshrc
. If you’re using a different shell, the file path and filename will be different on your machine. -
Add the following line and change
[PATH_OF_FLUTTER_GIT_DIRECTORY]
to be the path of your clone of the Flutter git repo:$ export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
- Run
source $HOME/.<rc file>
to refresh the current window, or open a new terminal window to automatically source the file. -
Verify that the
flutter/bin
directory is now in your PATH by running:$ echo $PATH
Verify that the
flutter
command is available by running:$ which flutter
Platform setup
macOS supports developing Flutter apps for iOS, Android, macOS itself and the web. Complete at least one of the platform setup steps now, to be able to build and run your first Flutter app.
iOS setup
Install Xcode
To develop Flutter apps for iOS, you need a Mac with Xcode installed.
-
Install the latest stable version of Xcode (using web download or the Mac App Store).
-
To configure the Xcode command-line tools to use the installed version, run the following commands.
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer $ sudo xcodebuild -runFirstLaunch
To use the latest version of Xcode, use this path. If you need to use a different version, specify that path instead.
-
Sign the Xcode license agreement. To sign the SLA, either:
-
Open Xcode and confirm.
-
Open the Terminal and run:
$ sudo xcodebuild -license
-
Versions older than the latest stable version might still work, but are not recommended for Flutter development.
With Xcode, you can run Flutter apps on an iOS device or on the simulator.
Set up the iOS simulator
To prepare to run and test your Flutter app on the iOS simulator, follow this procedure.
-
If using Xcode 15 or greater, download and install the iOS Simulator by running the following command:
$ xcodebuild -downloadPlatform iOS
If you want to use a different method of downloading and installing the iOS Simulator, check out Apple’s documentation on installing Simulators for more options.
-
To start the Simulator, run the following command:
$ open -a Simulator
-
Set your Simulator to use a 64-bit device (iPhone 5s or later).
-
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.
-
-
The simulated high-screen density iOS devices might overflow your screen. If that appears true on your Mac, 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.
-
Deploy to physical iOS devices
To deploy your Flutter app to a physical iPhone or iPad, you need to do the following:
- Create an Apple Developer account.
- Set up physical device deployment in Xcode.
- Create a development provisioning profile to self-sign certificates.
- Install the third-party CocoaPods dependency manager if your app uses Flutter plugins.
Create your Apple ID and Apple Developer account
To test deploying to a physical iOS device, you need an Apple ID.
To distribute your app to the App Store, you must enroll in the Apple Developer Program.
If you only need to test deploying your app, complete the first step and move on to the next section.
-
If you don’t have an Apple ID, create one.
-
If you haven’t enrolled in the Apple Developer program, enroll now.
To learn more about membership types, check out Choosing a Membership.
Attach your physical iOS device to your Mac
Configure your physical iOS device to connect to Xcode.
-
Attach your iOS device to the USB port on your Mac.
-
On first connecting your iOS device to your Mac, your iOS device displays the Trust this computer? dialog.
-
Click Trust.
-
When prompted, unlock your iOS device.
Enable Developer Mode on iOS 16 or later
Starting with iOS 16, Apple requires you to enable Developer Mode to protect against malicious software. Enable Developer Mode before deploying to a device running iOS 16 or later.
-
Tap on Settings > Privacy & Security > Developer Mode.
-
Tap to toggle Developer Mode to On.
-
Tap Restart.
-
After the iOS device restarts, unlock your iOS device.
-
When the Turn on Developer Mode? dialog appears, tap Turn On.
The dialog explains that Developer Mode requires reducing the security of the iOS device.
-
Unlock your iOS device.
Enable developer code signing certificates
To deploy to a physical iOS device, you need to establish trust with your Mac and the iOS device. This requires you to load signed developer certificates to your iOS device. To sign an app in Xcode, you need to create a development provisioning profile.
Follow the Xcode signing flow to provision your project.
-
Open Xcode.
-
Sign in to Xcode with your Apple ID.
- Go to Xcode > *Settings…
- Click Accounts.
- Click +.
- Select Apple ID and click Continue.
- When prompted, enter your Apple ID and Password.
- Close the Settings dialog.
Development and testing supports any Apple ID.
-
Go to File > Open…
You can also press Cmd + O.
-
Navigate to your Flutter project directory.
-
Open the default Xcode workspace in your project:
ios/Runner.xcworkspace
. -
Select the physical iOS device you intend to deploy to in the device drop-down menu to the right of the run button.
It should appear under the iOS devices heading.
-
In the left navigation panel under Targets, select Runner.
-
In the Runner settings pane, click Signing & Capabilities.
-
Select All at the top.
-
Select Automatically manage signing.
-
Select a team from the Team dropdown menu.
Teams are created in the App Store Connect section of your Apple Developer Account page. If you have not created a team, you can choose a personal team.
The Team dropdown displays that option as Your Name (Personal Team).
After you select a team, Xcode performs the following tasks:
- Creates and downloads a Development Certificate
- Registers your device with your account,
- Creates and downloads a provisioning profile if needed
If automatic signing fails in Xcode, verify that the project’s General > Identity > Bundle Identifier value is unique.
Enable trust of your Mac and iOS device
When you attach your physical iOS device for the first time, enable trust for both your Mac and the Development Certificate on the iOS device.
Agree to trust your Mac
You should enabled trust of your Mac on your iOS device when you attached the device to your Mac.
Enable developer certificate for your iOS devices
Enabling certificates varies in different versions of iOS.
-
Open the Settings app on the iOS device.
-
Tap on General > Profiles & Device Management.
-
Tap to toggle your Certificate to Enable
-
Open the Settings app on the iOS device.
-
Tap on General > VPN & Device Management.
-
Tap to toggle your Certificate to Enable.
-
Open the Settings app on the iOS device.
-
Tap on General > VPN & Device Management.
-
Under the Developer App heading, you should find your certificate.
-
Tap your Certificate.
-
Tap Trust “<certificate>“.
-
When the dialog displays, tap Trust.
If prompted, enter your Mac password into the codesign wants to access key… dialog and tap Always Allow.
Optional deployment procedures
You can skip these procedures. They enable additional debugging features.
Set up wireless debugging on your iOS device
Follow this procedure to debug your device using a Wi-Fi connection.
To use wireless debugging:
- Connect your iOS device to the same network as your macOS device.
- Set a passcode for your iOS device.
After you connect your iOS device to your Mac:
-
Open Xcode.
-
Go to Window > Devices and Simulators.
You can also press Shift + Cmd + 2.
-
Select your iOS device.
-
Select Connect via Network.
-
Once the network icon appears next to the device name, unplug your iOS device from your Mac.
If you don’t see your device listed when using flutter run
,
extend the timeout. The timeout defaults to 10 seconds.
To extend the timeout, change the value to an integer greater than 10.
flutter run --device-timeout 60
Learn more about wireless debugging
- To learn more, check out Apple’s documentation on pairing a wireless device with Xcode.
- To troubleshoot, check out Apple’s Developer Forums.
- To learn how to configure wireless debugging with
flutter attach
, check out Debugging your add-to-app module.
Install CocoaPods
Follow this procedure if your apps depend on Flutter plugins with native iOS code.
To Install and set up CocoaPods, run the following commands:
$ sudo gem install cocoapods
Android setup
Install Android Studio
- Download and install Android Studio.
- 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.
- Run
flutter doctor
to confirm that Flutter has located your installation of Android Studio. If Flutter cannot locate it, runflutter config --android-studio-dir=<directory>
to set the directory that Android Studio is installed to.
Set up your Android device
To prepare to run and test your Flutter app on an Android device, you need an Android device running Android 5.0 (API level 21) or higher.
- Enable Developer options and USB debugging on your device. Detailed instructions are available in the Android documentation.
- [Optional] To leverage wireless debugging, enable Wireless debugging on your device. Detailed instructions are available in the Android documentation.
- Windows-only: Install the Google USB Driver.
- Using a USB cable, plug your phone into your computer. If prompted on your device, authorize your computer to access your device.
- In the terminal, run the
flutter devices
command to verify that Flutter recognizes your connected Android device. By default, Flutter uses the version of the Android SDK where youradb
tool is based. If you want Flutter to use a different installation of the Android SDK, you must set theANDROID_SDK_ROOT
environment variable to that installation directory.
Set up the Android emulator
To prepare to run and test your Flutter app on the Android emulator, follow these steps:
- Enable VM acceleration on your machine.
- Launch Android Studio, click the Device Manager
icon, and select Create Device under Virtual tab…
- In older versions of Android Studio, you should instead launch Android Studio > Tools > Android > AVD Manager and select Create Virtual Device…. (The Android submenu is only present when inside an Android project.)
- If you do not have a project open, you can choose 3-Dot Menu / More Actions > Virtual Device Manager and select Create Device…
- Choose a device definition and select Next.
- Select one or more system images for the Android versions you want to emulate, and select Next. An x86 or x86_64 image is recommended.
- Under Emulated Performance, select Hardware - GLES 2.0 to enable hardware acceleration.
-
Verify the AVD configuration is correct, and select Finish.
For details on the above steps, see Managing AVDs.
- In Android Virtual Device Manager, click Run in the toolbar. The emulator starts up and displays the default canvas for your selected OS version and device.
Agree to Android Licenses
Before you can use Flutter, you must agree to the licenses of the Android SDK platform. This step should be done after you have installed the tools listed above.
- Open an elevated console window and run the following command to begin
signing licenses.
$ flutter doctor --android-licenses
- Review the terms of each license carefully before agreeing to them.
- Once you are done agreeing with licenses, run
flutter doctor
again to confirm that you are ready to use Flutter.
macOS setup
Additional macOS requirements
For macOS desktop development, you need the following in addition to the Flutter SDK:
Next step
Set up your preferred editor.