Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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