Before proceeding, make sure that you have set up a working environment for your host platform according to the guide.
There are two main commands, flutter run to run the app or flutter build to build for the specified platform.
When using flutter run you can specify the mode in which the app will run. By default, it uses the debug mode.
# debug mode:
flutter run
# release mode:
flutter run --release
# profile mode:
flutter run --profileTo build the app, use flutter build followed by the build target.
As an example, for the mobile platforms:
# Android APK:
flutter build apk
# Android app bundle:
flutter build appbundle
# iOS IPA:
flutter build iosOn macOS, Ruby is required for CocoaPods and Xcode tooling. Install Ruby 3.0+ (recommended: 3.4.x) using one of these version managers:
-
rbenv (recommended): lightweight, uses shims. Install via Homebrew and ruby-build.
brew install rbenv rbenv init # detects current shell and adds init command to shell config source ~/.zshrc || source ~/.bash_profile rbenv install 3.4.5 rbenv global 3.4.5 ruby -v
-
RVM: full-featured manager with gemsets.
\curl -sSL https://get.rvm.io | bash -s stable --ruby rvm install 3.4.5 rvm use 3.4.5 --default ruby -v
-
chruby (with ruby-install): minimal, simple switching.
brew install chruby ruby-install echo 'source /opt/homebrew/opt/chruby/share/chruby/chruby.sh' >> ~/.zshrc echo 'source /opt/homebrew/opt/chruby/share/chruby/auto.sh' >> ~/.zshrc source ~/.zshrc ruby-install ruby 3.4.5 chruby 3.4.5 ruby -v
You may also use alternatives like asdf or mise; ensure Ruby 3.0+.
CocoaPods 1.15+ is required for iOS/macOS builds with the latest Xcode.
NOTE: preferably do not install CocoaPods using sudo, as it may lead to permission issues.
gem install cocoapods
pod --versionIf you installed Ruby via a version manager, ensure the selected Ruby is active in your shell before installing CocoaPods.
Google Chrome is required, and the chrome binary must be accessible by the flutter command (e.g. via the system path)
flutter clean
flutter pub getRun in debug mode:
flutter run -d chromeRun in release mode:
flutter run -d chrome --releaseRunning on web-server (useful for testing/debugging in different browsers):
flutter run -d web-server --web-port=8080In order to build for macOS, you need to use a macOS host.
Prerequisites (macOS): Ensure Ruby 3.0+ and CocoaPods 1.15+ are installed. See Ruby setup and CocoaPods installation.
Before you begin:
- Open
macos/Runner.xcworkspacein XCode - Set Product -> Destination -> Destination Architectures to 'Show Both'
flutter clean
flutter pub getDebug mode
flutter run -d macosIf you encounter build errors, try to follow any instructions in the error message.
In many cases, simply running the app from XCode before trying flutter run -d macos again will resolve the error.
- Open
macos/Runner.xcworkspacein XCode - Product -> Run
Release mode
flutter run -d macos --releaseBuild
flutter build macosIn order to build for Windows, you need to use a Windows host.
Run flutter config --enable-windows-desktop to enable Windows desktop support.
If you are using Windows 10, please ensure that Microsoft WebView2 Runtime is installed for Webview support. Windows 11 ships with it, but Windows 10 users might need to install it.
Please ensure the following prerequisites are installed:
-
Visual Studio | Community 17.13.0 (Windows only), with the
Desktop development with C++workload installed. -
Nuget CLI is required for Windows desktop builds. Install with winget
winget install -e --id Microsoft.NuGet # Add a primary package source . $profile nuget sources add -name "NuGet.org" -source https://api.nuget.org/v3/index.json
-
Enable long paths in Windows registry. Open CMD or PowerShell as Administrator, run the following, and restart:
Set-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1
Before building for Windows, run flutter doctor to check if all the dependencies are installed. If not, follow the instructions in the error message.
flutter doctorflutter clean
flutter pub getDebug mode
flutter run -d windowsRelease mode
flutter run -d windows --releaseBuild
flutter build windowsIn order to build for Linux, you need to use a Linux host with support for libwebkit2gtk-4.1, i.e. Ubuntu 22.04 (jammy) or later.
Run flutter config --enable-linux-desktop to enable Linux desktop support.
Before building for Linux, run flutter doctor to check if all the dependencies are installed. If not, follow the instructions in the error message.
flutter doctorThe Linux dependencies, according to flutter.dev are as follow:
For Linux desktop development, you need the following in addition to the Flutter SDK:
- Clang
- CMake
- GTK development headers
- Ninja build
- pkg-config
- liblzma-dev (This might be necessary)
- libstdc++-12-dev
- webkit2gtk-4.1 (Webview support)
To install on Ubuntu 20.04 or later, run:
sudo apt-get install -y clang cmake git ninja-build pkg-config \
libgtk-3-dev liblzma-dev libstdc++-12-dev webkit2gtk-4.1 \
curl git unzip xz-utils zip libglu1-mesaUsers of Ubuntu 24.04 (Noble) or later, might need to install additional dependencies, and add PKG_CONFIG_PATH to their bash configuration. If that doesn't work, then try adding it to /etc/environment as well.
# Install xproto & xorg development libraries (xorg is precautionary, so can be excluded)
sudo apt-get install -y x11proto-dev xorg-dev libgl1-mesa-dev
# Check if PKG_CONFIG_PATH exists first before modifying or overwriting it
echo $PKG_CONFIG_PATH
# Add PKG_CONFIG_PATH to .bashrc only if it doesn't exist or is empty
if [ -z "$PKG_CONFIG_PATH" ]; then
echo "PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig" | sudo tee -a ~/.bashrc
source ~/.bashrc
pkg-config --cflags --libs gtk+-3.0
else
echo "PKG_CONFIG_PATH is already set."
fi
# Confirm that gtk+-3.0 is found in the output
flutter doctorflutter clean
flutter pub getDebug mode
flutter run -d linuxRelease mode
flutter run -d linux --releaseBuild
flutter build linuxBuilding an app for Android and iOS requires you to download their respective IDEs and enable developer mode to build directly to the device.
However, iOS tooling only works on macOS host.
For Android, after installing the IDE and initial tools using the setup wizard, run the app with flutter run.
Flutter will attempt to build the app, and any missing Android SDK dependency will be downloaded.
Running the app on an Android emulator has been tested on Apple Silicon Macs only; for other host platforms, a physical device might be required.
flutter cleanflutter pub get- Activate developer mode and USB debugging on your device
- Connect your device to your computer with a USB cable
- Ensure Flutter is aware of your device by running
flutter devices - Copy your device ID
- Run in debug mode with
flutter run -d <device-id> - Follow instructions on your device
Release mode:
flutter run -d <device-id> --releaseBuild APK:
flutter build apkBuild App Bundle:
flutter build appbundleIn order to build for iOS/iPadOS, you need to use a macOS host (Apple silicon recommended) Physical iPhone or iPad required, simulators are not yet supported.
Prerequisites (macOS): Ensure Ruby 3.0+ and CocoaPods 1.15+ are installed. See Ruby setup and CocoaPods installation.
flutter cleanflutter pub get- Connect your device to your Mac with a USB cable
- Ensure Flutter is aware of your device by running
flutter devices - Copy your device ID
- Run in debug mode with
flutter run -d <device-id> - Follow the instructions in the error message (if any)
In many cases it's worth trying to run the app from XCode first, then run
flutter run -d <device-id>again- Open
ios/Runner.xcworkspacein XCode - Product -> Run
- Open
- Follow the instructions on your device to trust the developer
Run in release mode:
flutter run -d <device-id> --releaseBuild:
flutter build ios