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"
  • Hi! Add the output of the cat ~/.bashrc to your question please!
    – antivirtel
    May 3 '11 at 16:14

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.

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

  1. Launch Terminal.app
  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/com.apple.Terminal.plist in order to add the xterm-color option do the following:

  1. Quit Terminal.app 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/com.apple.Terminal.plist
  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.
nano ~/.bashrc

Type Ctrl+W and search force_color, the first result should highlight the f, just after a # character.

Press Backspace and now Ctrl+X, then Y for Yes, then Enter.

source ~/.bashrc


. ~/.bashrc

You will now see color in the terminal.

I hope this works for you.


Rather than trying to force the macOS Terminal to report TERM as the older xterm-color, you can change your .bashrc on Linux to recognize xterm-256color as a color client. This seems to be the default for newer versions of Ubuntu. To do this, change this line:

xterm-color) color_prompt=yes;;


xterm-color|*-256color) color_prompt=yes;;

Then run source .bashrc and your terminal will display in color.


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!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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