need to source bash_profile in each new iterm window

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 PreferencesProfilesShell

In the "Startup" option activate the "Run Command" and type source ~/.profile.

0

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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like