Setup iOS apps develop environment on macOS
System requirements
Hardware requirements
Software requirements
TIP
You do not need to install Dart SDK separately as the Flutter SDK includes the full Dart SDK.
Operating system
- macOS 10.15 (Catalina) or later.
Development tools
Download and install the following packages:
Xcode 15 to debug and compile native Swift or ObjectiveC code. The Xcode installation includes Git to manage source code.
WARNING
Use the latest Xcode if possible, but do not choose the beta version.
Install
Open the App Store and sign in.
Search for Xcode.
Click Install.
To configure the command-line tools to use the installed version of Xcode, use the following commands:
bashsudo sh -c 'xcode-select -s /Applications/Xcode.app/Contents/Developer && xcodebuild -runFirstLaunch'
Use this path for the latest version of Xcode. If you need to use a different version, specify that path instead.
TIP
For example, the name of Xcode located in Applications is Xcode-15.1.0; adjust the command to:
bashsudo sh -c 'xcode-select -s /Applications/Xcode-15.1.0.app/Contents/Developer && xcodebuild -runFirstLaunch'
Sign the Xcode license agreement:
bashsudo xcodebuild -license
Cocoapods 1.15 or later to compile enable Flutter plugins in your native apps.
Install
Use brew to install. Run the command in Terminal:
bashbrew install cocoapods
When install finishs, run the command:
bashbrew link cocoapods
Configure a text editor or IDE
You can build apps with Flutter using any text editor or integrated development environment (IDE) combined with Flutter's command-line tools.
Using an IDE with a Flutter extension or plugin provides code completion, syntax highlighting, and other features.
Popular options include:
- Visual Studio Code 1.77 or later with the Flutter extension for VS Code.
- Android Studio 2023.2.1 (Iguana) or later with the Flutter plugin for IntelliJ.
- IntelliJ IDEA 2023.2 or later with the Flutter plugin for IntelliJ.
RECOMMENDED
The Flutter team recommends installing Visual Studio Code and the Flutter extension for VS Code. This combination simplifies installing the Flutter SDK.
Install the Flutter SDK
In this guide, we will setup Flutter SDK at . You can change where you want to put it.
Warning
Don't install Flutter to a directory or path that meets the following conditions:
- The path contains special characters or spaces.
As an example, fails the condition.
Add Flutter to your PATH
The guide will show you two commonly used shells: and . If you are using other shell, please search for their guide of setting PATH.
Configure your target iOS device
WARNING
For the Hackathon participants, Please setup a simulator for demo.
WARNING
Since the requirement of deploying to a physical ios device is way too high, our guide will only cover iOS virtual device setup.
To deploy to physical iOS device, you need:
- Create an Apple ID, then register to Apple Developer Program (annual payment required).
- Create a development provisioning profile to self-sign certificates.
Configure your iOS virtual device
To install the iOS virtual device, run the following command:
bashxcodebuild -downloadPlatform iOS
Check if any virtual device exists in Xcode:
Open Xcode.
▼ Xcode 起始頁
In menu bar: Window > Device and Simulators, hotkey: + + .
Click Simulators tab.▼ Xcode Device and Simulators
If there is no existing virtual device, click + at left-bottom corner to add one.
▼ Xcode Device and Simulators
To start the virtual device, run the following command:
bashopen -a Simulator
▼ Open iOS virtual device
Check your development setup
Run Flutter doctor
The flutter doctor
command validates that all components of a complete Flutter development environment for macOS.
Open your Terminal.
run the following command:
bashflutter doctor
As you chose to develop for iOS, you do not need all components. If you followed this guide, the result of your command should resemble:
Running flutter doctor... Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.24.0, on macOS ...). [!] Android toolchain - develop for Android devices [!] Chrome - develop for the web [✓] Xcode - develop for iOS and macOS [!] Android Studio (not installed) [✓] VS Code (version ...) [✓] Connected device (1 available) [✓] Network resources ! Doctor found issues in ... categories.
Highlights are required:
- : build Flutter.
- : build iOS app.
- : at least one simulator to demo.
- : project's components and plugin requires network connection to download or update.
Troubleshoot Flutter doctor issues
When the command returns an error, it could be for Flutter, VS Code, Android Studio, the connected device, or network resources.
If the command returns an error, you can run with again to gain more information:
flutter doctor -v
Check the output for other software you might need to install or further tasks to perform.
If you change the configuration of your Flutter SDK or its related components, run flutter doctor
again to verify the installation.
Start developing iOS on macOS apps with Flutter
Congratulations. Having installed all prerequisites and the Flutter SDK, you can start developing Flutter apps for iOS on macOS.