68

I am going to set the path for mySQl on my computer (I'm running Snow Leopard) but I see different instructions online.

Some say to change the .profile file and some say to change the .bash_profile file. What is the difference?

redconservatory
  • 21,438
  • 40
  • 120
  • 189

2 Answers2

89

.profile works with sh or bash. However .bash_profile is bash-specific and will override .profile if present.

Paul R
  • 208,748
  • 37
  • 389
  • 560
50

I believe mac OS X environment checks .bash_profile, .bash_login, .profile in this order. It will run whichever is the highest in the hierarchy, so, if you have .bash_profile, it will not check .profile.

Jorge Leitao
  • 19,085
  • 19
  • 85
  • 121
hlim
  • 945
  • 1
  • 9
  • 16
  • 4
    I can confirm that. I just installed google cloud sdk which created a .bash_profile when I was using .profile for all my other variables and a lot of applications stopped to work. – Danielito Apr 17 '14 at 10:43
  • 2
    I believe .bashrc should be in that list? – tscizzle Oct 10 '14 at 18:19
  • 2
    @tscizzle - The mentioned list is valid for a login shell – sras Oct 12 '15 at 04:29
  • 1
    to make the answer complete - could you please add the role of .bashrc ? I read that there is a distinction between "login shells" and "non login interactive shells" and I don't really understand it -- but still you could add clarification - that all those .bash_xxxxx are for "login shells" (whatever they may be) and .bashrc for the others. – Motti Shneor May 07 '19 at 12:27