Learn how to set up your development environment to run, build, and deploy Flutter apps for iOS devices.

Set up iOS tooling

#

With Xcode, you can run Flutter apps on an iOS physical device or on the iOS Simulator.

  1. Install Xcode

    If you haven't done so already, install and set up the latest version of Xcode.

    If you've already installed Xcode, update it to the latest version using the same installation method you used originally.

  2. Set up Xcode command-line tools

    To configure the Xcode command-line tools to use the version of Xcode you installed, run the following command in your preferred terminal:

    sudo sh -c 'xcode-select -s /Applications/Xcode.app/Contents/Developer && xcodebuild -runFirstLaunch'

    If you downloaded Xcode elsewhere or need to use a different version, replace /Applications/Xcode.app with the path to there instead.

  3. Agree to the Xcode licenses

    After you've set up Xcode and configured its command-line tools, agree to the Xcode licenses.

    1. Open your preferred terminal.

    2. Run the following command to review and sign the Xcode licenses.

      sudo xcodebuild -license
    3. Read and agree to all necessary licenses.

      Before agreeing to the terms of each license, read each with care.

  4. Download prerequisite tooling

    To download iOS platform support and the latest iOS Simulator runtimes, run the following command in your preferred terminal.

    xcodebuild -downloadPlatform iOS
  5. Install Rosetta

    If you're developing on an Apple Silicon (ARM) Mac, install Rosetta 2:

    sudo softwareupdate --install-rosetta --agree-to-license
  6. Install CocoaPods

    To support Flutter plugins that use native iOS or macOS code, install the latest version of CocoaPods.

    Install CocoaPods by following the CocoaPods installation guide.

    If you've already installed CocoaPods, update it by following the CocoaPods update guide.

Set up an iOS device

#

We recommend starting with the iOS Simulator as it's easier to get set up than a physical iOS device. However, you should also test your app on an actual physical device.

Start the iOS Simulator with the following command:

open -a Simulator

If you need to install a simulator for a different OS version, check out Downloading and installing additional Xcode components on the Apple Developer site.

Set up each iOS device on which you want to test.

  1. Configure your physical iOS device

    1. Attach your iOS device to the USB port on your Mac.

    2. On first connecting an iOS device to your Mac, your device displays the Trust this computer? dialog.

    3. Click Trust.

      Trust Mac

  2. Configure your physical iOS device

    Apple requires enabling Developer Mode on the device to protect against malicious software.

    1. Tap on Settings > Privacy & Security > Developer Mode.

    2. Tap to toggle Developer Mode to On.

    3. Restart the device.

    4. When the Turn on Developer Mode? dialog appears, tap Turn On.

  3. Create a developer code signing certificate

    To send your app to a physical iOS device, even for testing, you must establish trust between your Mac and the device. In addition to trusting the device when that popup appears, you must upload a signed developer certificate to your device.

    To create a signed development certificate, you need an Apple ID. If you don't have one, create one. You must also enroll in the Apple Developer program and create an Apple Developer account. If you're just testing your app on an iOS device, a personal Apple Developer account is free and works.

  4. Prepare the device

    1. Find the VPN & Device Management menu under Settings.

      Toggle your certificate to Enable.

    2. Under the Developer App heading, you should find your certificate.

    3. Tap the certificate.

    4. Tap Trust "<certificate>".

    5. When the dialog displays, tap Trust.

      If the codesign wants to access key... dialog appears:

      1. Enter your macOS password.

      2. Tap Always Allow.


Start developing for iOS

#

Congratulations. Now that you've set up iOS development for Flutter, you can continue your Flutter learning journey while testing on iOS or begin improving integration with iOS.