How to Add Flutter to Your PATH on macOS

Sathish Kumar
2 min readSep 5, 2024

To use Flutter commands from the Terminal on macOS, you need to add Flutter to your PATH environment variable. Here’s a step-by-step guide to help you set this up using the default zsh shell.

Step 1: Open Terminal

Launch the Terminal application on your Mac. You can find it in Applications > Utilities or by searching for it using Spotlight.

Step 2: Create or Edit the ~/.zshenv File

  1. Check for Existing File: First, check if the ~/.zshenv file exists:
ls -al ~/.zshenv

If the file does not exist, you’ll need to create it.

2. Create or Edit the File:

Open the file in a text editor. You can use nano for simplicity:

nano ~/.zshenv

This above command create new .zshenv file

Step 3: Add Flutter to Your PATH

export PATH=$HOME/src/flutter/bin:$PATH

This above line appends the Flutter binary path to your existing PATH variable. Considering i have the flutter folder inside Home path srcfolder

  1. Save and Exit:
  • If you’re using nano, save the file by pressing Ctrl + O, then press Enter to confirm. Exit by pressing Ctrl + X.
  • If using vim, press Esc to enter command mode, type :wq, and press Enter to save and exit.

Step 4: Apply the Changes

To make the changes take effect, you need to refresh your Terminal session. Run the following command:

source ~/.zshenv

Step 5: Verify Flutter Installation

To ensure that Flutter is correctly added to your PATH, run:

flutter --version

This command should display the Flutter version if everything is set up correctly.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Sathish Kumar
Sathish Kumar

Written by Sathish Kumar

Hands on experience in iOS | Swift UI

No responses yet

Write a response