How to Change Your Default Terminal Prompt in Mac OS X

By default, when you open up a new Terminal window in Mac OS X the command prompt displays a relatively long name:

I prefer to shorten this to a simple dollar sign ($) in order to free up space.

To change your default command line prompt, follow these instructions:

1) Navigate to your home directory:

cd ~

2) Create a file called .bash_profile

vi .bash_profile

3) Add the following line (press i)

export PS1="$ "

4) Save the file (press Escape, type :wq and hit Enter)

5) Restart Terminal

You should now see something like this:

There are other ways you can configure the command prompt (for example, showing the current time), but I prefer to keep it simple.

23 thoughts on “How to Change Your Default Terminal Prompt in Mac OS X

  1. I prefer export=”W $ ” so I can see the current working directory.

    If I traverse from home directory to /Users/###/code/sites I see the following prompts:

    $ cd code
    code $ cd sites
    sites $

  2. If I want to change it again, how do I do that? Once I type vi .bash_profile it doesn’t let me change the previous settings I’ve set up.

    1. Hey, when you open it in vi again it should reflect your previous changes. You might need to do:

      vi ~/.bash_profile

      To ensure it loads it from the home directory.

  3. Now that Bbedit reverts a form of Textwrangler after the trial period expires, I suggest that folks use it rather than vi. It’s much more user friendly.

Leave a comment