Updating the PATH variable for Flutter on Mac

Updated: February 4, 2023 By: A Goodman 3 comments

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 the absolute path of your flutter directory 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 doctor

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
3 Comments
Inline Feedbacks
View all comments
David Ng
David Ng
9 months ago

It solved my problem! Thanks

jgrodriguezr
jgrodriguezr
1 year ago

The last command its flutter doctor

Related Articles