I am on macbook pro, el capitan. I have aliases set in .bash_profile, which work in the first instance of iTerm, however they are not recognized if I open a new iTerm instance, I have to do source ~/.bash_profile each time.
Can they somehow be remembered for all instances?
3 Answers
Actually for newest macOS you go to GUI of the terminal and in the:
Terminal Preferences → Profiles → Shell
In the "Startup" option activate the "Run Command" and type source ~/.profile.
Depending on if it is a login shell or an interactive one, bash will source either the ~/.bash_profile or the ~/.bashrc. iTerm is most likely looking for ~/.bashrc.
You can simply put a line at the beginning of each file:
At the top of ~/.bash_profile
export BASH_CONF="bash_profile"At the top of ~/.bashrc
export BASH_CONF="bashrc"And then simply type $ echo $BASH_CONF in a new iTerm instance.
go to settings and under Profile > General > Command select "Command" radio button and use /bin/bash --login as the command. This will load your .bash_profile.