Updating the PATH variable for Flutter on Mac

Last updated on January 24, 2022 A Goodman Loading... Post a comment

After downloading Flutter, you need to update your path in order to run flutter commands via the terminal. In macOS 10.15 or beyond (Catalina, Big Sur, Monterey), you need to edit the .zshrc file instead of the .bashrc or .bash_profile file.

In the process, you may face a big problem: you cannot find the .bashrc file on your Mac. The steps below will help you.

1. First, navigate to Go > Home from your Desktop screen:

Now, you are at the Home directory, but the .zshrc file is hidden and you still cannot see it:

2. Simply press “command” + “shift” + “>” to show all the hidden files. After that, open the .zshrc file with your favorite text editor.

3. Add this line to the .zshrc file:

export PATH="$PATH:[PATH_TO_YOUR_FLUTTER_DIRECTORY]/flutter/bin"

Change [PATH_TO_YOUR_FLUTTER_DIRECTORY] with your own path (the place flutter was downloaded on your computer). You can show your flutter directory absolute path by right click on it and selecting “Get info”.

In my case, the .zshrc file looks like this:

4. Test your work by opening your Mac terminal and executing the command below:

flutter docker

You should see something like this:

That’s all, buddy. Further reading:

You can also take a tour around our Flutter topic page and Dart topic page to see the latest tutorials and examples.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

Related Articles