If you want to run flutter and dart commands from any terminal or IDE, you need to add the Flutter SDK’s bin directory to your system’s PATH environment variable. Without this, your system won’t know where to find Flutter, and your development setup may not work.

Here’s a clear step-by-step guide for both Windows and macOS users.


Windows Setup

1. Locate Your Flutter SDK

Find the folder where you extracted Flutter.
Copy the absolute path to this folder.


2. Open Environment Variables

  • Press Windows + Pause
    (If your keyboard doesn’t have a Pause key, try Windows + Fn + B.)
  • In the System > About dialog, click:
    Advanced System Settings → Advanced → Environment Variables…

3. Add Flutter to PATH

  • In User variables for (your username), find the Path entry.
    • If it exists:
      1. Double-click it.
      2. In an empty row, paste the path to Flutter’s bin directory.
        Example:
        %USERPROFILE%\develop\flutter\bin
      3. Move this entry to the top of the list.
    • If Path doesn’t exist:
      1. Click New.
      2. Variable NamePath
      3. Variable Value:
        %USERPROFILE%\develop\flutter\bin

4. Save Changes

Click OK on all dialogs.
Close and reopen your terminals and IDEs.


5. Validate

In Command Prompt, run:

flutter --version
dart --version

If the commands aren’t recognized, check your PATH again.


macOS Setup (Zsh)

This tutorial assumes you’re using Zsh, the default macOS shell. If you use another shell, adjust the instructions accordingly.


1. Locate Your Flutter SDK

Find the folder where you extracted Flutter.
Copy its absolute path.


2. Edit .zshenv

Open (or create) your .zshenv file:

nano ~/.zshenv

3. Add Flutter to PATH

At the end of the file, add:

export PATH="$HOME/development/flutter/bin:$PATH"

(Replace "$HOME/development/flutter" with your actual path.)


4. Save and Apply

  • Save (CTRL+OEnter in nano)
  • Close and reopen all terminal windows.

5. Validate

Run:

flutter --version
dart --version

If either command isn’t found, recheck your .zshenv settings.

Find More Content on Deadloq, Happy Learning!!

Leave a Reply

Your email address will not be published. Required fields are marked *