This problem suddenly appeared out of nowhere and shows in both Terminal and iTerm2.

When I start the apps, usually they would run my selected shell, whose path is configured as /opt/homebrew/bin/bash. This shell would then source .bashrc, .profile and .bash_profile. Now all of a sudden, none of these files are getting sourced, causing all sorts of havoc.

For instance, a fresh iTerm instance shows

echo $SHELL

But none of my init files are sourced. Now if I manually run /opt/homebrew/bin/bash, everything gets sourced. Same if I just run plain bash from /bin/bash.

The app is configured to run /opt/homebrew/bash -l as a login shell:

enter image description here

Yet it just doesn't work, and apparently in each tab I have to manually run the shell.

What could this be caused by and what can I do about it? I have run chsh -s /opt/homebrew/bin/bash to no avail.

  • Where are your init files located?
    – Allan
    Commented Jan 28 at 11:38
  • home directory.
    – oarfish
    Commented Jan 28 at 11:42
  • Don't forget to accept one of the answers. If none of the answers solver your problem, edit your question and explain what is still missing. Commented Jun 29 at 8:07

2 Answers 2


With your configuration, only .bash_profile should be sourced.

.profile is not sourced, if .bash_profile exists.

.bashrc is not sourced, if the shell is a login shell.

I suggest that you put your configuration settings which should be processesd for both login and non-login shells, into a separate file (say: .bash_common), and source this file from .bash_profile and .bashrc.

  • Or as the bash manual suggests add to .bash_profile the line if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
    – mmmmmm
    Commented Jun 27 at 19:58

Actually it turns out .bash_profile is getting sourced, so adding . $HOME/.bashrc and the like here will make it work again. But I don't really understand why ~/.bashrc is not getting sourced regardless for interactive shells.

  • 3
    .bashrc is not run automatically for login shells, you‘ll need to source it specifically.
    – nohillside
    Commented Jan 28 at 12:05
  • 2
    @oarfish Please read the INVOCATION section of the bash man page, it details under what conditions bash reads its various rc files. Commented Jan 28 at 15:48
  • 1
    Because it is documented in this way, in the bash man-page: When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that file exists. Don't ask me why the designers of bash decided it in this way. Commented Feb 2 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .