Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like the CasebashMac:bfgenv chris$ part of the following line to appear in a different color in my terminal.

CasebashMac:bfgenv chris$ python
share|improve this question

I set the PS1 variable in my .bashrc to achieve this.

  • Open Terminal
  • [editorofchoice] ~/.bashrc
  • Add a line with the following:

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

  • Save the .bashrc
  • Exit Terminal and re-open. You should now have a green prompt.
share|improve this answer
Where is this bashrc file? – Casebash Oct 17 '10 at 0:45
@Casebash It should be in you home folder for your user account. If it does not exist, which often it doesn't, just create it. – BinaryMisfit Oct 17 '10 at 8:43
“.bashrc” won’t be there by default, and since it has a DOT, you won’t see it in finder (unless you have told it to show invisible files). Therefore it’s usually safe to use “vi” or “pico" to edit the file, because if it doesn’t exist, it will create it. – Martín Marconcini Oct 17 '10 at 14:02
It works if I run the command using export, but not in my .bashrc file. CasebashMac:~ chris$ cat ~/.bashrc PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[0‌​1;34m\]\w\[\033[00m\]\$ ' – Casebash Oct 17 '10 at 20:04
@Casebash. I am not sure what he problem is. I copied that straight out of the .bashrc on my machine. The actual PS1 line I got from my Ubuntu Server since I wanted both to be the same. Also make sure you exit both the terminal and quit terminal and then reopen. – BinaryMisfit Oct 18 '10 at 9:07

The information you need to search for this is that the terminal runs a copy of the Bash shell. There are many tutotials and other documents on the web to tell you more.

One guide to customising the prompt is from IBM

share|improve this answer
+1 - This is nice. – boehj Jun 24 '11 at 17:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.