Skip to content

CuttyRobot/flutter-install-macos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

flutter-install-macos

Easy instruction for Flutter install on Mac OS.

Install Brew on Mac OS

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

Add brew in path, if brew is asking for it. Example:

echo >> /Users/<user_name>/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<user_name>/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

Install XCode

Install XCode from App Store or from official Apple Web-site.

Install XCode CLI

After installing Xcode, if you installed XCode at first and Homebrew after that - brew would install XCode CLI automatically

xcode-select --install

Now it is required to accept license

sudo xcodebuild -license accept

Install actual ruby for MacOS

brew install ruby

And after install next step is to set up new Ruby as default to system:

echo 'export PATH="/opt/homebrew/opt/ruby/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc 

For check, after addind new ruby path to zhrc restart console and use this command:

ruby -v    # It shoud show version 3.3.x
which ruby # Should be /opt/homebrew/opt/ruby/bin/ruby

CocoaPods install

Classic cocoapds instalation with gem is pretty slow and can get several instalation errors, nowaday we can install cocoapods via brew, it would take much less time.

brew install cocoapods
pod setup

Check:

pod --version

Install Rosetta2

sudo softwareupdate --install-rosetta --agree-to-license

Flutter SDK install

Download & install Flutter SDK directly

Download package from officiala web-site and create folder for it

mkdir -p ~/development
cd ~/development
unzip ~/Downloads/flutter_macos_3.29.3-stable.zip

Adding Flutter to PATH

echo 'export PATH="$PATH:$HOME/development/flutter/bin"' >> ~/.zshrc
source ~/.zshrc

Check up result of installation

which flutter
flutter --version

These two commands would show path of Flutter SDK and version of Flutter

Flutter Doctor

After install easiest way to understand what to do further - is to use command flutter doctor

flutter doctor

It would show something like this:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.3, on macOS 15.5 24F74 darwin-arm64 (Rosetta),
    locale en-US)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from:
      https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK
      components.
      (or visit https://flutter.dev/to/macos-android-setup for detailed
      instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[!] Xcode - develop for iOS and macOS       
    ✗ Xcode installation is incomplete; a full installation is necessary for iOS
      and macOS development.
      Download at: https://developer.apple.com/xcode/
      Or install Xcode via the App Store.
      Once installed, run:
        sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
        sudo xcodebuild -runFirstLaunch
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] Connected device (2 available)            
[✓] Network resources

! Doctor found issues in 3 categories.

As displayed can see

  1. Doctor asks to install Android Studio, it's not extra required, but it would make installation much easier
  2. Xcode need initiation
  3. Android toolchain is unable - it can be done only after android install.

After this two commands flutter became ready to work with iOS and XCode

sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch

Now we are installing Android Studio(for example 2024.3.2)

After installation we need to accept all requirements and install components alt text On start page of Android Studio we need to go to "More Actions" and chose SDK Manager alt text Then on way going to SDK tools tab on top and searching for Android SDK Command Line Tools alt text

Installing it, and after that we can run flutter doctor again.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.3, on macOS 15.5 24F74 darwin-arm64 (Rosetta),
    locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor
      --android-licenses
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] Connected device (3 available)
[✓] Network resources

Using command provided by Flutter Doctor:

flutter doctor --android-licenses
<user-name>@mac development % flutter doctor --android-licenses
/Users/<user-name>/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager: line 173: test: : integer expression expected
[=======================================] 100% Computing updates...             
4 of 6 SDK package licenses not accepted.
Review licenses that have not been accepted (y/N)? y

And after that you would need to accept other licenses\

Now one more check flutter doctor:

[✓] Flutter (Channel stable, 3.29.3, on macOS 15.5 24F74 darwin-arm64 (Rosetta),
    locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Wonderful, we installed flutter on Mac OS with Android, Chrome and iOS and MacOS.
This small instruction-article was made for flutter new-comers and others who want to watch how to start code on flutter

About

Simple instruction for Flutter installation on Mac OS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published