DEV Community

Cover image for Installing Flutter on MacOS
LalitKumar
LalitKumar

Posted on

Installing Flutter on MacOS

Hi Everyone!
Flutter is a cross-platform software development kit by Google. It is one of the burning topic of the Internet. So to get started with it we need to install the sdk and all other dependencies correctly for it to run on our laptop successfully.
Here is a very short article explaining how to install Flutter on your MacBook with seven easy steps.

Step-1: Install Flutter SDK from its official website.
OR
You can download the zip file from here.


Step-2: Save the zip file to your desired location or preferably to Documents. Mark the path to this location(to be used on later steps).


Step-3: Open Terminal (CMD+Space and search Terminal)
Type ls and check if 'Documents' folder is showing.
If not showing then type cd ~ to go to home directory.


Step-4: Unzip the file using any file archiver utility like WinRAR
OR
Use follow these sub-steps to unzip using terminal

1-->

cd Documents
Enter fullscreen mode Exit fullscreen mode

2-->

unzip ~/Downloads/flutter_macos_2.10.0-stable.zip
Enter fullscreen mode Exit fullscreen mode

Step-5: Adding flutter to path (temporarily).

export PATH="$PATH:`pwd`/flutter/bin"
Enter fullscreen mode Exit fullscreen mode

Run flutter doctor command to ensure flutter is working.

After you close the terminal then you won't be able to use flutter commands through terminal again. So we need to add flutter tools to path permanently.


Step-6: Adding flutter tool to path (permanently). This step is bit complicated, so be careful.

Run pwd on the terminal and copy the path and save it somewhere.

Then run echo $0 to which shell you are using.

If you are getting ~zsh then follow these steps:

  • vim ~/.zshrc Run this command to open vim editor

  • export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
    Write this command on vim editor.
    Here replace [PATH_OF_FLUTTER_GIT_DIRECTORY] with the path that you got by running the pwd command earlier

  • Press ESC

  • Type :wq and press Enter

If you are using ~bash then follow these steps:

  • touch ~/.bash_profile; open ~/.bash_profile This opens TextEdit File.

  • export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
    Type this command on and replace [PATH_OF_FLUTTER_GIT_DIRECTORY] with the path that you got by running the pwd command earlier

  • Save the file


Step-7: Run this command to confirm that the path is added successfully.

flutter doctor 
Enter fullscreen mode Exit fullscreen mode

You can visit the Official Flutter Installation documentation for MacOS installation guide.
If you have any query then contact me through LinkedIn.

Top comments (0)