Terminal Colors Not Working
Solution 1:
There is a sample, default .bashrc file located in /etc/skel - you could make a backup of your current .bashrc with mv .bashrc .bashrc.bak
and then cp /etc/skel/.bashrc .bashrc
to copy that sample back to your home directory. After that, un-comment force_color_prompt=yes
in the new file and add [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
back to the end (last line) of the file so that RVM still works.
After that, execute . .bashrc
at a prompt to reload your bash profile, which should give you a colored prompt again and test RVM with the command type rvm | head -1
which should return the text: rvm is a function
If this doesn't work, please let us know if you are using the standard Terminal app on Mac OS X, and what profile you are using in Terminal on your Mac.
Solution 2:
The colors have stopped working, most probably after you upgraded to Lion from Snow Leopard.
In Lion, for some reason, by default the terminal is declared as "xterm-256color" instead of "xterm-color" which is what Ubuntu understands.
One of the options is for you, as mentioned by previous responders, uncomment force_color_prompt=yes
in ~/.bashrc
The other option is to redeclare in Terminal.app the terminal as xterm-color. Here's how to do that:
- Launch Terminal.app
- Go to menu Terminal -> Preferences (or use Cmd + ,)
- Go to the
Settings
tab and find the theme that is set as default - Go to the
Advanced
tab - Find the drop down next to
Declare terminal as:
and set it to xterm-color
Here are my Settings
UPDATE: It seems that Mountain Lion removed the xterm-color option completely from the drop down menu. If you're doing an upgrade you will most probably keep your old configuration, but if you are doing a fresh install, you'll have to manually edit Terminal's configuration file and for that you will need a plist editor (included in XCode that need to be installed via the App Store). The location of Terminal's file is in ~/Library/Preferences/com.apple.Terminal.plist in order to add the xterm-color option do the following:
- Quit Terminal.app if it's currently running
- Install XCode from the App Store (skip this step if you have installed it already)
$ open ~/Library/Preferences/com.apple.Terminal.plist
- Navigate the plist to
Root > Window Settings
- locate the name of your default theme (in my case that’s Pro) expand it and find the
TerminalType
key. - Now just change the
TerminalType
key to xterm-color manually - save the file and launch Terminal.