Macos – ~/.profile not being executed when Terminal opens? [OS X 10.6.8]


Somehow my bash prompt got changed to "elementary:~ steven$" and I want to change it back to the default prompt. I've added the following first to ~/.bashrc then to ~/.profile:

export PS1="\s-\v\$ "

Neither get executed when I open Terminal. If I run the command source on either file it works fine for the remainder of that session.

Is there something I'm overlooking here?

EDIT: Here's output from what Ian suggested:

elementary:~ steven$ bash --login --verbose
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
/usr/libexec/path_helper -s
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Library/Frameworks/Python.framework/Versions/3.2/bin:/usr/local/AVRMacPack/bin"; export PATH;

if [ "${BASH-no}" != "no" ]; then
    [ -r /etc/bashrc ] && . /etc/bashrc
# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
if [ -e "/usr/local/AVRMacPack" ]; then
export PATH

# Setting PATH for Python 3.2
# The orginal version is saved in .bash_profile.pysave
export PATH
elementary:~ steven$ which bash
which bash

Best Answer

.bashrc is only executed for non-interactive shells according to the bash man page.

.bash_profile is executed for login shells.

The .profile file is loaded by Korn shells. I don't know that bash pays any attention to this at all. I couldn't find any reference to it in the bash man page.

On OS X the program runs a login shell for every single new window you open.

So you want to put your prompt setup in .bash_profile.

You could always do the following in .bash_profile. It's not uncommon but I can't say what kind of repercussions it could have:

if [ -f ~/.bashrc ]; then
   source ~/.bashrc

Then you wouldn't have to maintain two files.