On my linux system (ubuntu), when I create a certain alias in ~/.bashrc and then restart the terminal/system, the alias always works again, without reloading anything.

But on my MAC system, when I create the same alias in the same file, it only works in the current terminal session, but not anymore after restarting the terminal. I need to do source ~/.bashrc to get it loaded again.

Question: How/where do I create the alias in my MAC system so that it always works, without reloading anything?

link|improve this question

feedback

1 Answer

up vote 2 down vote accepted

Put the following in .bash_profile:

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

Depending on how the terminal is launched, it will run either .bash_profile or .bashrc.

If you want the alias to be available everywhere it needs to run with the login terminal which loads the profile.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.