You'll find many of the tools you need to set up your environment at https://flutter.dev. Execute the following steps:
- Click on a very visible Get Started link or button on the page.
- From there, you'll have to choose your operating system (in this case, macOS), and then download the Flutter SDK, which is a .zip file. Create a folder for the content of the file, such as ~/flutterdev.
- In order to create a new directory on the root of your Mac, open a Terminal window, and type the following command:
mkdir ~/flutterdev
- Next, extract the content of the zipped file into the new directory. From the Terminal, type the following code:
cd ~/ flutterdev
$ unzip ~/Downloads/flutter_macos_v1.2.1-stable.zip
- You may need to change the Flutter SDK version, depending on the version available at the time you perform the installation.
- At the end of the process, you should have a folder containing the flutterdev folder, with its files.
- Next, you'll need to update your PATH variable. This will allow you to run Flutter commands in any Terminal session.
- From a Terminal window, go to your root folder by typing cd ~/.
- Then, if you haven't created a .bash_profile yet, type the following command:
touch .bash_profile
- Create your new file. Edit .bash_profile with your favorite editor, or type the following command:
open -e .bash_profile
- In the file, type export PATH=/home/flutterdev/bin:$PATH and then, from the Terminal, run source $HOME/.bash_profile.
- Check whether the PATH has been correctly updated by typing $ echo $PATH.
You will see the path you've set on the Terminal.