Skip to content

Why is the conda initialize block placed in .bashrc on Linux, but in .bash_profile on macOS + Windows? #11830

@pavelzw

Description

@pavelzw

Checklist

  • I added a descriptive title
  • I searched open requests and couldn't find a duplicate

What is the idea?

I don't really understand why the conda initialize section is placed in the .bashrc when using conda on Linux and in the .bash_profile when initialising conda on macOS or Windows (see here).

I created a small git blame timeline here.

@kalefranz you were responsible for adding the conda initialize block to the .bash_profile instead of .bashrc on macOS. Is there a reason for it?

This seems weird to me, especially since the macOS terminal sources the .bashrc by default when executing bash in the command line.
bash sources the .bashrc when executed in the interactive mode (i.e. bash -i) and the .bash_profile when using the login mode (i.e. bash -l). In a regular terminal, the interactive mode is the default. See the bash man page.

Here is a small list when which rcfile gets sourced (this is the same for Ubuntu and macOS, haven't tested Windows but I suppose it's the same...):

  • .bashrc gets sourced when executing bash or bash -i in the terminal.
  • .bash_profile gets sourced when executing bash -l in the terminal.
  • Only .bash_profile gets sourced when executing bash -il

Why is this needed?

No response

What should happen?

This can be confusing; therefore, we should have better documentation surrounding this behavior. Please update the documentation for this repository accordingly.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogissue has been triaged but has not been earmarked for any upcoming releasegood first issuegreat for new contributors, code change is envisioned to be trivial/relatively straight-forwardlocked[bot] locked due to inactivitytype::documentationrequest for improved documentation

    Type

    No type

    Projects

    Status

    🏁 Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions