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

  1. Download Flutter:

  2. Extract the ZIP file:

    • Open Terminal and navigate to your Downloads folder:

        cd ~/Downloads
      
    • Extract the Flutter SDK:

        unzip flutter_macos_<version>-stable.zip
      
  3. Move to Applications:

    • Move the extracted Flutter folder to a desired location:

        mv flutter /Applications/
      
  4. 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

  1. Download Xcode:

    • Install Xcode from the App Store.
  2. Install Xcode Command Line Tools:

    • Open Terminal and run:

        xcode-select --install
      
  3. Accept the Xcode license:

     sudo xcodebuild -license
    

4. Install Homebrew (optional)

Homebrew is a package manager that can help with installing dependencies.

  1. 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:

  1. Download Android Studio:

  2. 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

  1. 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

  1. To create a new Flutter project, run:

     flutter create my_app
    
  2. Navigate to your project directory:

     cd my_app
    
  3. Run the app:

     flutter run