Add Flutter to PATH on Linux and Fix Command Not Found

open book9 minutes read



How to Add flutter SDK To Linux path permanently ##




If your Linux terminal says flutter: command not found, the Flutter SDK is usually installed but its bin folder is not on the PATH used by your current shell. The fix is simple, but the right file depends on whether you use Bash, Zsh, Fish, or another shell.

Quick Answer

First, replace $HOME/development/flutter with the real folder where your Flutter SDK lives. The path must end at the Flutter SDK folder, not the parent folder above it.

Before you append another line, check whether a Flutter PATH entry already exists. If you find an old or wrong Flutter path, correct that entry instead of adding the same thing again and again.

grep -n "flutter/bin" ~/.bashrc ~/.zshenv ~/.profile 2>/dev/null
ShellPermanent command
Bashecho 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.bashrc
Zshecho 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.zshenv
Fishfish_add_path -g -p ~/development/flutter/bin

Close and reopen your terminal after running the command. Then verify both Flutter and Dart:

flutter --version
dart --version

Those commands follow the current Flutter’s PATH instructions: put the Flutter SDK bin directory on PATH, restart terminal sessions and IDEs, then validate with flutter and dart.

Confirm the Flutter SDK Location

Before editing PATH, confirm where Flutter is actually installed. If you downloaded Flutter manually, common locations are $HOME/development/flutter, $HOME/flutter, or /opt/flutter. If you installed through Snap, the SDK may be under ~/snap/flutter/common/flutter.

ls $HOME/development/flutter/bin/flutter
ls $HOME/flutter/bin/flutter
ls /opt/flutter/bin/flutter
ls ~/snap/flutter/common/flutter/bin/flutter

Use the first path that exists on your machine. If none of those files exist, do a bounded search inside your home directory before you assume Flutter is missing:

find "$HOME" -maxdepth 4 -type f -path "*/flutter/bin/flutter" 2>/dev/null

If this prints a path, remove the trailing /bin/flutter. The remaining folder is the SDK path you should use in the PATH examples. If it prints nothing, PATH is not your first problem yet. Install or locate the SDK first, then come back to this step. If you still need the base setup, start with our guide to install Flutter on Linux.

Identify the Active Shell

Linux PATH changes are read by your shell. Editing ~/.bashrc will not help if your terminal opens Zsh or Fish. Check the shell used by new terminal windows:

echo "$SHELL"
ps -p $$ -o comm=

If the output ends with bash, use the Bash instructions. If it ends with zsh, use Zsh. If it says fish, use Fish. The second command is useful when your login shell and current interactive shell are not the same.

Add Flutter to PATH Permanently

Bash

For Bash, append the Flutter SDK bin folder to ~/.bashrc. This is the most common setup on Ubuntu and many Linux distributions.

echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.bashrc

If your SDK lives somewhere else, change only the path before /bin. For example:

echo 'export PATH="$HOME/flutter/bin:$PATH"' >> ~/.bashrc

Zsh

For Zsh on Linux, use ~/.zshenv for this Flutter PATH entry. That keeps the Flutter command available to new Zsh sessions.

echo 'export PATH="$HOME/development/flutter/bin:$PATH"' >> ~/.zshenv

Fish

Fish has its own PATH helper. Use fish_add_path instead of adding an export line to a Bash or Zsh file.

fish_add_path -g -p ~/development/flutter/bin

The -g flag stores the path globally for Fish, and -p prepends Flutter so it wins over older installs. Open a new Fish session after changing it, then verify with command -v flutter. Do not run source ~/.bashrc for Fish.

Other Shells

If you use sh or ksh, add an export PATH=... line to ~/.profile. If you use csh or tcsh, use Flutter’s shell-specific examples for the matching startup file and syntax.

Reload the Shell and Verify PATH

You can source the file you edited, but the most reliable check is a fresh terminal window. That catches the same startup path a future terminal will use.

# Bash
source ~/.bashrc

# Zsh
source ~/.zshenv

# Then inspect PATH
printf '%s\n' "$PATH" | tr ':' '\n' | grep flutter

If the output includes your Flutter SDK bin folder, the shell has read your PATH entry. If it does not, you edited the wrong file, used the wrong SDK path, or the current shell is not the one you thought it was. For Fish, open a new Fish session and use fish_user_paths or command -v flutter instead of sourcing Bash or Zsh files.

Verify Flutter and Dart

Now check which executable the shell will run. Prefer command -v for a clean script-friendly answer, and use type -a when you suspect multiple installs.

command -v flutter
command -v dart
type -a flutter
type -a dart
flutter --version
dart --version

Both flutter and dart should resolve through the Flutter SDK. Dart is bundled with Flutter, so a separate old Dart install earlier in PATH can confuse projects.

Troubleshoot flutter: command not found

Use this order when the terminal still cannot find Flutter: confirm the binary exists, confirm the SDK bin folder is in PATH, see which executable resolves, confirm you edited the right shell file, reload the session, check for multiple installs, then check the IDE environment.

ls /your/flutter/path/bin/flutter
printf '%s\n' "$PATH" | tr ':' '\n' | grep flutter
command -v flutter
type -a flutter
echo "$SHELL"
ps -p $$ -o comm=
SymptomLikely causeHow to checkFix
flutter: command not foundbin missing from PATH.command -v flutterAdd the SDK bin to the active shell file.
Works only until restart.Temporary export only.Open a new terminal.Persist it in Bash, Zsh, or Fish config.
Edited ~/.bashrc, still broken.You use Zsh or Fish.echo "$SHELL"Edit the active shell’s file.
PATH entry exists, still broken.Wrong SDK folder.ls .../bin/flutterFix the path, then reopen terminal.
Works in one terminal only.Different shell/session.Compare both terminals.Update the shell each terminal uses.
Dart resolves outside Flutter.Old Dart wins PATH order.type -a dartPut Flutter bin earlier.

If Flutter still cannot run after these checks, use Flutter installation troubleshooting to separate PATH problems from SDK download, network, Android, and platform setup failures.

Fix VS Code or IDE PATH Mismatch

A common Linux trap is that Flutter works in your terminal, but VS Code still cannot find it. That usually means VS Code was launched from the desktop environment and did not inherit the same PATH as your shell.

  • Compare an external terminal with the VS Code integrated terminal using command -v flutter and flutter --version.
  • Run Flutter: Run Flutter Doctor from the VS Code Command Palette.
  • Restart VS Code after changing PATH.
  • Close and reopen every integrated terminal.
  • Try launching VS Code from a terminal where command -v flutter already works.
  • If the extension still cannot find Flutter, set dart.flutterSdkPath to the Flutter SDK folder, not the bin folder.

The Dart Code PATH notes explain why terminal startup files do not always apply to GUI-launched VS Code, and the Dart Code SDK lookup order show that an explicit dart.flutterSdkPath setting can override PATH-based lookup.

Check Multiple Flutter or Dart Installations

If your machine has Flutter from Snap, a manual SDK download, and maybe an old Dart package, the shell may run a different executable than the one you expect. Check every match:

type -a flutter
type -a dart
flutter --version
dart --version

If the first Flutter path is not the SDK you want, move your preferred Flutter bin path earlier in PATH. The examples above put Flutter before $PATH for that reason.

For example, if type -a flutter shows a Snap path before your manual SDK, the Snap command wins. If type -a dart shows /usr/lib/dart/bin/dart before Flutter’s bundled Dart, projects may use the wrong Dart version. PATH is read from left to right, so the first match is the one your shell runs.

Be especially careful after copying commands from different installation guides. One guide may assume a manual SDK in $HOME/development/flutter, another may assume Snap, and another may assume /opt/flutter. Pick one installation and make PATH point to that exact SDK. Mixing several locations makes upgrades harder and can leave VS Code, Dart, and the terminal disagreeing about which Flutter version is active.

When flutter doctor -v Is No Longer a PATH Problem

Once flutter --version and dart --version work, PATH is mostly solved. Now run:

flutter doctor -v

Do not keep editing ~/.bashrc because flutter doctor reports Android SDK, Chrome, emulator, license, or Linux desktop toolchain issues. Those are separate setup tasks.

Doctor categoryWhat it usually meansWhere to fix it
Android SDK or licensesAndroid Studio, command-line tools, platform tools, or licenses are missing.Android Studio SDK Manager and flutter doctor --android-licenses.
Linux desktop toolchainPackages such as compiler, CMake, Ninja, pkg-config, GTK, or C++ runtime headers are missing.Linux desktop setup.
Chrome or web deviceBrowser tooling is missing or not detected.Flutter web setup, not PATH.
Network or pub errorsFlutter can run, but dependency fetching or network access is failing.Network, proxy, VPN, certificate, or pub.dev access.

FAQ

Should Flutter go before or after $PATH?

Put Flutter before $PATH if you want this SDK to win over older Flutter or Dart installations. That is usually the cleanest setup for a development machine.

Is ~/.bashrc always the right file on Ubuntu?

No. It is right for Bash terminal sessions, but not for Zsh or Fish. Always check the active shell first.

Why does export PATH work once but disappear later?

A plain export PATH=... command changes only the current shell process. To make it permanent, write the line into the startup file your shell reads.

Do I need sudo to edit PATH?

Usually no. Your Flutter SDK and shell startup file should normally live in your home directory. Avoid sudo unless you intentionally installed Flutter into a system directory and know why.

Can I use Snap Flutter instead of a manual SDK?

Yes, but do not mix setup assumptions. Snap Flutter uses different paths, and some commands may resolve through Snap. Check type -a flutter before changing unrelated files.

What should I do after PATH works?

Run flutter doctor -v, fix the specific platform warnings, and then create or open a Flutter project. If you are tuning the rest of your Linux setup, our Linux developer tools guide can help you round out the environment.


Share on



Author: Learndevtools

Enjoyed the article? Please share it or subscribe for more updates from LearnDevTools.




Read also




Also, explore other topics and expand your knowledge.

#Actor #AI #alternative tools #Analytics #Android Studio #Apify #apis #aws #Beginner's Guide #blog writing #Bulma css #business performance #Causes and Fixes #CD/CI #ChromeOS #cloud architecture #CMS #code review #code writing #contentful #Crawlee #cross-platform #css #css courses #css framework #css frameworks #css grid #css properties #css tutorials #data #developer tools #Development Companies #difference between #docker #documentation #drawing tools #ecommerce solutions #Email builder #email deliverability #email delivery #flexbox #Flutter #foundation css #framework #free software #Free tool #global SaaS products #How-to guide #html #html tutorials #iinbox placement #Internationalization #IT #js #Kubernetes #llmops #Localization #macOS #ML #netflix #Open source #organizational improvment #OS #plugins #PR #pr review #Private markets #Project Management #QR Code #React Native #Remote tools #renewable energy #saas #SaaS localization #seo #SEO Compatitor Analysis #Serverless #Software #software developer tools #store #storyblok #strapi #Stripe #tailwind #tailwind css #Tech hacks #Technical Writing #Technical Writing Tips #Technical Writing Tools #Tips and tricks #TOP 10 #Translation #ubuntu #UX #Windows #wordpress #writing #Xcode #Youtube