Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between .profile and .bash_profile on Snow Leopard

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?

like image 370
redconservatory Avatar asked Jul 19 '11 17:07

redconservatory


People also ask

What is the use of bash_profile in Mac?

bash_profile. This file is loaded before Terminal loads your shell environment and contains all the startup configuration and preferences for your command line interface. Within it you can change your terminal prompt, change the colors of text, add aliases to functions you use all the time, and so much more.

Is Bashrc the same as bash_profile?

bash_profile is read and executed when Bash is invoked as an interactive login shell, while . bashrc is executed for an interactive non-login shell. Use . bash_profile to run commands that should run only once, such as customizing the $PATH environment variable .

Where is the bash_profile in Macos?

Go the users home directory. Check if the bash_profile is visible there or not. If not, press Command + Shift + . and bash_profile will be visible.


2 Answers

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

like image 145
Paul R Avatar answered Oct 17 '22 08:10

Paul R


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.

like image 50
hlim Avatar answered Oct 17 '22 08:10

hlim