Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I am accessing an Ubuntu 10.04.2 LTS server via SSH from OSX. Recently the colors stopped working. I think it happened while I was installing/troubleshooting RVM, but I am not positive.

In .bashrc I uncommeneted force_color_prompt=yes, and when I run env | grep TERM I get TERM=xterm-color. But still no colors.

Any ideas? Thanks!

Here is the output of cat .bashrc

# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color) color_prompt=yes;;

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
   alias dir='dir --color=auto'
   alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
    . /etc/bash_completion

[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"
share|improve this question

migrated from May 3 '11 at 16:06

This question came from our site for professional and enthusiast programmers.

Hi! Add the output of the cat ~/.bashrc to your question please! –  B. Roland May 3 '11 at 16:14

3 Answers 3

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.

share|improve this answer
Thanks! It works for me! –  Michael Z Sep 21 '12 at 7:56
Works for me, Xubuntu 13.04 –  Green Jul 6 '13 at 22:29

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 the terminal as xterm-color. Here's how to do that:

  1. Launch
  2. Go to menu Terminal -> Preferences (or use Cmd + ,)
  3. Go to the Settings tab and find the theme that is set as default
  4. Go to the Advanced tab
  5. 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/ in order to add the xterm-color option do the following:

  1. Quit if it's currently running
  2. Install XCode from the App Store (skip this step if you have installed it already)
  3. $ open ~/Library/Preferences/
  4. Navigate the plist to Root > Window Settings
  5. locate the name of your default theme (in my case that’s Pro) expand it and find the TerminalType key.
  6. Now just change the TerminalType key to xterm-color manually
  7. save the file and launch Terminal.
share|improve this answer

One alternative you have is to crate a .bash_login file if one doesn't already exist in your home directory, and put .bashrc inside.

Close the terminal and reopen it--your problem should be solved!

share|improve this answer

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.