Skip to content

[Linux] “Add SDK to PATH” creates ~/.bash_profile instead of updating ~/.bashrc #6182

Closed

Description

@dharmatech

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

  1. Use Ubuntu with /bin/bash as the default shell.

  2. Have ~/.profile and ~/.bashrc, but no ~/.bash_profile.

  3. Install Flutter using the VS Code Flutter installation workflow.

  4. Click Add SDK to PATH.

  5. Open a new VS Code integrated terminal.

  6. 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:

#5711

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

  1. added this to the v3.144.0 milestone on Sep 14, 2026
  2. DanTup commented on Sep 14, 2026

    @DanTup
    Member

    Yeah, this seems wrong. We used .bash_profile on 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:

    Image Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in commandsRelates to commands (usually invoked from the command Palette)is bugon linux

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions