.bash_profile

Hello!

I need to edit my .bash_profile.
It doesn't exist (I checked in the Terminal using ls -a).
I know how to create the file in Terminal or Text Wrangler, I just don't know what to put in it.
Help :0)

Cheers!

MacBook Pro 4,1, Mac OS X (10.5.8), MBP 4,1 | 2.5 GHz CPU | 2 GB RAM | GeForce 8600 M GT

Posted on Nov 4, 2010 8:43 PM

Reply
7 replies

Nov 5, 2010 12:40 AM in response to RM Emmons

This is what I have in mine, plus a bunch of alias commands that I use routinely, but didn't include:

export PATH=$PATH:/usr/local/bin:/Developer/Tools:/Developer/usr/bin/:/usr/X11/bin:/us r/libexec/:
export MANPATH="/usr/share/man:/usr/local/share/man:/usr/X11R6/man:/Developer/usr/shar e/man:"

Just create it and then copy it to your home directory.

Nov 5, 2010 6:31 AM in response to RM Emmons

You do not get a .bash_profile by default, as it is ONLY needed if you want to modify bash shell environment when you start a new Terminal session. If you are happy with the default bash shell environment, then there is no need for a .bash_profile.
One final question, do I need to create .bashrc and .profile as well or will .bash-profile do? I am attempting to install RVM so I can learn Ruby on Rails on my own.

If you search "man bash", you will find a section on bash initialization files, and the rules for when different ones are invoked.

.profile is ONLY used if it exists and there is NO .bash_profile in your home directory. bash will NOT read both, and .bash_profile is selected over .profile if both happen to exist.

.bashrc is read when a subshell is created. For example, if you issue the command 'bash' while already in a Terminal session, or if you are in a Unix text editor and ask for a temporary subshell so you can do something and then return to the editor. Or other similar situations where a subshell is desired.

.bashrc is NOT read when a new Terminal session is created, unless you personally "source $HOME/.bashrc" as part of your .bash_profile.

The typical division of labor between .bash_profile and .bashrc is that environment variables and other once per new Terminal session activies are done in .bash_profile. Aliases, command prompt (PS1 - if you are dynamically changing it because you are in a subshell), and other settings that are not inherited by a subshell are put into .bashrc

Most Mac OS X users, that rarely use the Terminal, are just fine using .bash_profile, or no .bash_profile at all.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

.bash_profile

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.