Mac os

How to Install and Configure Flutter SDK on Mac os

Prerequisites:

Before we begin, make sure your macOS meets the following requirements:

  • Operating System: macOS (64-bit)

  • Disk Space: At least 2.8 GB of free space

  • Xcode: Version 12.0 or later with the Command Line Tools installed

  • Dart SDK: Flutter relies on Dart, so ensure you have the Dart SDK installed on your machine.

Now, let’s get started with the installation process:

Step 1: Download Flutter:

  1. Open your preferred web browser and navigate to the official Flutter website: https://flutter.dev/.

  2. Click on the “Get started” button, which will redirect you to the Flutter installation page.

  3. Scroll down and locate the “macOS” section. Click on the “flutter_macos_2.x.x-stable.zip” link to start the download.

Step 2: Extract and Move Flutter:

  1. Once the download completes, open the “Downloads” folder or the location where the ZIP file was saved.

  2. Double-click on the downloaded ZIP file to extract its contents.

  3. Move the extracted “flutter” folder to your desired location. For example, you can move it to your home directory or any other convenient location on your Mac.

Step 3: Set Up Flutter Environment Variables:

  1. Open Terminal on your Mac. You can find it in the “Applications” folder, under the “Utilities” subfolder.

  2. Run the following command to open your shell profile configuration file

open -e .bash_profile

If you’re using Zsh, run the following command instead:

open -e .zshrc

3. Add the following line at the end of the file:

export PATH="$PATH:<path_to_flutter>/flutter/bin"

Replace <path_to_flutter> with the actual path where you moved the "flutter" folder in Step 2.

4. Save the file and close the text editor.

Step 4: Verify Flutter Installation:

  1. Close and reopen the Terminal to apply the changes made to the shell profile configuration.

  2. Run the following command to verify the Flutter installation:

flutter doctor

This command checks for any necessary dependencies and provides recommendations if anything is missing.

3. If prompted, type “y” to accept the Android licenses.

4. The output of the command will show the status of Flutter’s installation and highlight any issues that need to be resolved.

Congratulations! 🎉 🎉 🎉 You have successfully installed Flutter on your macOS.

Optional Steps (but highly recommended):

Step 5: Install Xcode:

  1. If you haven’t installed Xcode, visit the Mac App Store and search for “Xcode”.

  2. Click on the “Get” or “Install” button to download and install Xcode.

  3. Launch Xcode once the installation is complete and accept the license agreement, if prompted.

Step 6: Configure iOS Simulator:

  1. Open Xcode and navigate to “Preferences” from the “Xcode” menu.

  2. Go to the “Locations” tab and ensure that the Command Line Tools dropdown displays the latest Xcode version.

  3. Switch to the “Components” tab and click on the “Simulator” option.

  4. Select a simulator (e.g., iPhone 11) and click on the “Download” button next to it to install the necessary simulator files.