Repository navigation
[Linux] “Add SDK to PATH” creates ~/.bash_profile instead of updating ~/.bashrc #6182
Description
Description
When installing Flutter through VS Code on Ubuntu, I clicked Add SDK to PATH after the SDK installation completed.
The extension reported that Flutter had been added successfully, but flutter was not available in a newly opened VS Code integrated terminal.
I found that the extension had created a new ``~/.bash_profile` containing only:
export PATH="/home/<user>/develop/flutter/bin:$PATH"~/.bash_profile did not exist before this action. My home directory already contained the normal Ubuntu ~/.profile and ~/.bashrc files.
Steps to reproduce
-
Use Ubuntu with
/bin/bashas the default shell. -
Have
~/.profileand~/.bashrc, but no~/.bash_profile. -
Install Flutter using the VS Code Flutter installation workflow.
-
Click Add SDK to PATH.
-
Open a new VS Code integrated terminal.
-
Run:
command -v flutter
Actual behavior
The extension creates ~/.bash_profile and adds the Flutter SDK path there.
A normal VS Code Bash terminal is an interactive non-login shell and reads ~/.bashrc, not ~/.bash_profile, so Flutter is not added to its PATH.
Creating ~/.bash_profile also changes Bash login behavior. Bash reads the first available file from ~/.bash_profile, ~/.bash_login, and ~/.profile. Therefore, creating this new file can prevent the user's existing ~/.profile from being read by Bash login shells.
Expected behavior
On Linux with Bash, the extension should follow the Flutter Linux documentation and add the SDK path to ~/.bashrc.
Alternatively, it should avoid creating ~/.bash_profile when that file does not already exist and select an appropriate existing startup file without shadowing ~/.profile.
Relevant implementation and documentation
The current implementation explicitly returns .bash_profile when $SHELL is Bash:
| return ".bash_profile"; |
Flutter’s Linux installation documentation instructs Bash users to update ~/.bashrc:
https://docs.flutter.dev/install/add-to-path#linux
Bash startup-file behavior is documented here:
https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
The Linux support appears to have been introduced in:
Environment
- OS: Ubuntu 26.04.1 LTS
- Shell:
/bin/bash - VS Code: 1.137.0
- Dart extension: 3.142.0
- Flutter extension: 3.142.0
Workaround
Moving the Flutter PATH entry to ~/.bashrc resolves the issue:
export PATH="$HOME/develop/flutter/bin:$PATH"
Activity
DanTup commentedon Sep 14, 2026
Yeah, this seems wrong. We used
.bash_profileon macOS and then enabled Linux assuming the same was correct. I asked Gemini and ChatGPT which we should use where, and it agrees we picked wrong for Linux:Use .bashrc for "Add to Path" on Linux, not .bash_profile