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
  • 20,518
  • 40
  • 116
  • 186

2 Answers2

88

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

Paul R
  • 202,568
  • 34
  • 375
  • 539
49

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
  • 17,168
  • 17
  • 78
  • 114
hlim
  • 935
  • 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
  • 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