Installing Xcode on Mac for Flutter

Codecademy Team
Developing Flutter apps on a Mac has advantages - developers can build and run Flutter apps for both Android and iOS.

To develop for Mac, we need Xcode. Xcode only runs on macOS and will allow us to build Flutter apps for use on iOS devices such as iPhones and iPads.

This article will walk through installing Xcode so we can build Flutter for iOS devices.

Install XCode

Navigate to the XCode on the Mac App Store page and click on Open App Store.

Opening the App Store

This will open the Apple App Store app for XCode. It will display details about the Xcode application.

Installing Xcode from the App Store

Click on the download icon to install Xcode.

Installing Brew and Cocoapods

Another component we need for Apple development is Cocoapods. Cocoapods is an open-source package management tool for the Xcode build environment. It is necessary to install this tool as Flutter synchronizes necessary packages with the Dart environment.

We can get Cocoapods using a tool called Brew. Brew is an open-source and freely available installation tool for our Mac. We will need to install this first. To do this, open a terminal and type:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Once this is completed we can use brew to install Cocoapods.

We will need to open a terminal and type:

brew install cocoapods

Our Mac should now be set up for Flutter development and running Flutter apps on iOS and macOS devices. Our next step will be to verify our Flutter environment.

Review

While installing Xcode is not required for starting Flutter development, it is necessary to install if we want to deploy Flutter apps on iOS and macOS devices. Let’s review a few topics we have covered in this article.

  • Macs allow us to set up a development environment to target both Android and iOS devices with Xcode.
  • Xcode should be installed first from the App Store on our Mac.
  • We then need to install the Brew and Cocoapods package managers.