0

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.

2
  • 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, 2010 at 13:33
  • My root user's shell is /bin/sh according to dscl. Maybe that's the problem?
    – Daniel Beck
    Nov 3, 2010 at 14:12

2 Answers 2

3

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.

1
  • 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, 2010 at 14:51
1

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.

You must log in to answer this question.

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