Develop Flutter App On MacOS
To set up Flutter on a Mac, follow these steps:
1. System Requirements
Make sure your Mac meets the following requirements:
macOS (64-bit)
Disk space: 2.8 GB (does not include disk space for IDE/tools)
2. Install Flutter SDK
Download Flutter:
Go to the Flutter SDK releases page.
Download the latest stable release (a
.zip
file).
Extract the ZIP file:
Open Terminal and navigate to your Downloads folder:
cd ~/Downloads
Extract the Flutter SDK:
unzip flutter_macos_<version>-stable.zip
Move to Applications:
Move the extracted Flutter folder to a desired location:
mv flutter /Applications/
Add Flutter to your PATH:
Open (or create) the
~/.zshrc
file in a text editor:nano ~/.zshrc
Add the following line:
export PATH="$PATH:/Applications/flutter/bin"
Save and exit the file, then run:
source ~/.zshrc
3. Install Xcode
Download Xcode:
- Install Xcode from the App Store.
Install Xcode Command Line Tools:
Open Terminal and run:
xcode-select --install
Accept the Xcode license:
sudo xcodebuild -license
4. Install Homebrew (optional)
Homebrew is a package manager that can help with installing dependencies.
Open Terminal and run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
5. Install Android Studio (optional)
If you plan to develop for Android:
Download Android Studio:
- Go to the Android Studio download page.
Install the Flutter and Dart plugins:
- Open Android Studio, go to Preferences > Plugins, and search for Flutter and Dart to install them.
6. Run Flutter Doctor
To check for any dependencies you may still need, run: bashCopy
flutter doctor
- Follow any instructions provided to resolve issues.
7. Create a New Flutter Project
To create a new Flutter project, run:
flutter create my_app
Navigate to your project directory:
cd my_app
Run the app:
flutter run