.bash_profile, .bashrc, …

 

A bit more technical around different initialization files

.bash_profile .bashrc
Unix: .bash_profile is loaded by login shells Unix: .bashrc is loaded by interactive shells
Except for Mac, which loads the login shell for every new terminal (interactive or not)
[1] ‘by convention’ (not macOS) most here sourcing .bash_profile

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

[1] macOS sourcing .bashrc most here

‘for OSX, the convention is to start every new Terminal as an interactive login shell.’

 

 

$HOME/.bash_profile – File

$ cat ~/.bash_profile 
if [ -f $HOME/.bashrc ]; then
        source $HOME/.bashrc
fi

$HOME/.bashrc – File

Where putting stuff when dealing with macOS

$HOME/.profile – File

Not usually dealt with, on macOS, at least not in later years.