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.’ |
- google.com/search?q=bashrc+vs+bash_profile
- [1] superuser.com/questions/703415/why-do-people-source-bash-profile-from-bashrc-instead-of-the-other-way-round
$HOME/.bash_profile – File
(2020-02-12 file timestamp) mbp17:~ johan$ cat .bash_profile
$ cat ~/.bash_profile if [ -f $HOME/.bashrc ]; then source $HOME/.bashrc fi
$HOME/.bashrc – File
Where putting stuff when dealing with macOS
(2021-01-19 file timestamp), mbp17:~ johan$ cat .bashrc
alias la='ls -a' alias ll='ls -l' alias vlc='/Applications/VLC.app/Contents/MacOS/VLC' alias cvlc='/Applications/VLC.app/Contents/MacOS/VLC -I rc' # general path munging PATH=${PATH}:~/bin PATH=${PATH}:/usr/local/bin F=~/.dropbox/comgt_init.sh if [ -e $F ] ; then . $F # else echo "No $F" fi
See also jandp.biz/is/apps/dropbox/home-dropbox/ for dropbox inits…
$HOME/.profile – File
Not usually dealt with, on macOS, at least not in later years.