1

I'm quite new to developing under OSX and assigned some aliases and other preferences in the ~/.profile initially, however it got quite big and messy after a while because I had a lot of Environment Variables to define too.

So I created a ~/.bashrc file (as you would on linux) and placed all my aliases and preferences there. However, since every instance of mac terminal is a login terminal, it doesn't read the .bashrc but just .profile...

So my solution was to place a source .bashrc at the bottom of ~/.profile and that does the job. So I'm wondering whether that is not good and if there is a better and cleaner way of doing that, since this is a bit of a hack?

1

https://stackoverflow.com/questions/9953005/should-the-bashrc-in-the-home-directory-load-automatically/9954208#9954208

See here. It's OK to add source ~/.bashrc to ~/.profile.

3
  • Oh, that is a very helpful diagram. So if I understood correctly it is actually better to source it from .bash_login? However (since it is FIRST) would it reach my .profile, to instantiate my env vars? – G.Rassovsky Dec 19 '14 at 12:16
  • @G.Rassovsky Actually I haven't used .bash_login myself. .profile won't get reached if there exists .bash_login. Maybe it's better to use ~/.profile (in my opinion). – dofine Dec 19 '14 at 12:53
  • ah yes, i think you're actually right, i didn't spot this straight away... so best just keep my source .bashrc in .profile and not worry too much about it. :) – G.Rassovsky Dec 19 '14 at 14:44

Your Answer

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

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