Super User is a question and answer site for computer enthusiasts and power users. 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've added the following lines to my .bash_profile at /Users/[my username] :

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

And it works fine. However, when I did the same for root's .bash_profile at /var/root it doesn't work. Any ideas why this doesn't work for root?

Thanks.

share|improve this question
    
Yes, I know I'm supposed to use sudo. ;-) Nonetheless, I still would like to know how to enable this for root. – GeneQ Nov 3 '10 at 13:33
    
My root user's shell is /bin/sh according to dscl. Maybe that's the problem? – Daniel Beck Nov 3 '10 at 14:12
up vote 3 down vote accepted

You can toss those into ~/.profile or source the relevant file from ~/.profile inside the home directory for the root user, and then log in via sudo su - to simulate a full login. It works for me on BASH on Snow Leopard.

As a side note, I define the alias, alias ls='ls -G', in my .bashrc files to enable colour output for ls.

share|improve this answer
    
Changed the name of .bash_profile of root to .profile as you suggested and now it works beautifully. However, .bash_profile works for other users though. Thanks. – GeneQ Nov 3 '10 at 14:51

Put the following into the /var/root/.bashrc file:

export PS1="\[\033[03;31m\][\u@\h\[\033[03;37m\] \W \[\033[03;31m\]]\\$ \[\033[00m\]"
alias grep='grep --color'
export CLICOLOR='yes'
TERM=xterm-color

Being root, type the following:

chsh -s /bin/bash

Exit and 'sudo su' back to root.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .