Install Flutter on Mac
Installing Flutter on macOS: A Comprehensive Guide
Flutter is a popular open-source UI software development kit created by Google. It is used to develop applications for Android, iOS, Linux, Mac, Windows, Google Fuchsia, and the web from a single codebase. This guide will walk you through the process of installing Flutter on your macOS machine, setting up your development environment, and getting ready to build your first Flutter application.
1. System Requirements
Before you begin, ensure your development environment meets the following minimum requirements:
- Operating System: macOS (64-bit)
- Disk Space: 2.8 GB (this does not include disk space for IDEs and other tools)
- Tools: Flutter uses
git
for installation and upgrades. It’s recommended to have Xcode installed, which includesgit
. If not, you can install it separately.
2. Download the Flutter SDK
You can download the Flutter SDK directly or by using a version manager.
Manual Download and Installation
-
Download the Flutter SDK: Go to the official Flutter website’s macOS install page and download the latest stable release of the Flutter SDK.
-
Extract the SDK: Once downloaded, extract the zip file to a desired location, such as
~/development
.unzip flutter_macos_*.zip -d ~/development
Using a Version Manager (Recommended)
Using a version manager like fvm
(Flutter Version Management) is highly recommended for managing multiple Flutter versions.
-
Install FVM: If you have Homebrew installed, you can install FVM with the following command:
brew tap leoafarias/fvm brew install fvm
-
Install a Flutter Version: To install a specific version of Flutter, use the following command:
fvm install stable
3. Update Your Path
To use the flutter
command in your terminal, you need to add the Flutter SDK to your PATH
.
-
Open your shell’s configuration file. This is typically
~/.zshrc
for Zsh (the default shell in modern macOS) or~/.bash_profile
for Bash.open ~/.zshrc
-
Add the Flutter tool to your path: Add the following line to the end of the file, replacing
[PATH_TO_FLUTTER_SDK]
with the actual path to your Flutter SDK’sbin
directory.export PATH="$PATH:[PATH_TO_FLUTTER_SDK]/bin"
If you placed Flutter in
~/development
, the line would be:export PATH="$PATH:$HOME/development/flutter/bin"
-
Apply the changes: Save the file and then run the following command in your terminal to apply the changes:
source ~/.zshrc
-
Verify the installation: Run the following command to ensure the
flutter
command is available:which flutter
This should output the path to your Flutter SDK.
4. Run Flutter Doctor
Now, run the flutter doctor
command. This command checks your environment and displays a report of the status of your Flutter installation.
flutter doctor